com.alibaba.fastjson.JSONArray.forEach()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(1215)

本文整理了Java中com.alibaba.fastjson.JSONArray.forEach()方法的一些代码示例,展示了JSONArray.forEach()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONArray.forEach()方法的具体详情如下:
包路径:com.alibaba.fastjson.JSONArray
类名称:JSONArray
方法名:forEach

JSONArray.forEach介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

// jsonResult is a string that contains your ES response
 JSONArray json = (new JSONObject(jsonResult)).getJSONObject("hits").getJSONArray("hits");
 List<JSONArray> result = new ArrayList<>();
 json.forEach((j) -> {
   JSONObject highlight = ((JSONObject) j).getJSONObject("highlight");
   result.add(highlight.getJSONArray("name"));
 });
 // Outputs [[" <em>Smartwatch<\/em> Phone"], [" <em>Smartwatch<\/em>"], [" 3G <em>Smartphone<\/em>"]]
 System.out.println(result);

代码示例来源:origin: xixifeng/fastquery

public static List<String> getQueries() {
  List<String> strs = new ArrayList<>();
  JSONArray jsonArray = getJsonObject().getJSONArray("queries");
  if (jsonArray == null) {
    return strs;
  }
  jsonArray.forEach(s -> strs.add(s.toString()));
  return strs;
}

代码示例来源:origin: top.wboost/common-kylin

/**
 * 查询列表
 * @param kylinApiSearch
 * @return
 */
public static List<JSONObject> queryList(KylinApiSearch kylinApiSearch) {
  JSONArray apiListFind = KylinQueryAction.queryByApiSearch(kylinApiSearch, JSONArray.class);
  List<JSONObject> returnList = new ArrayList<>();
  if (!CollectionUtil.isEmpty(apiListFind)) {
    apiListFind.forEach((result) -> {
      returnList.add((JSONObject) result);
    });
  }
  return returnList;
}

代码示例来源:origin: code4everything/efo

public static Hashtable<String, Integer> loadToken() {
  Hashtable<String, Integer> tokens = new Hashtable<>(ValueConsts.SIXTEEN_INT);
  try {
    String token = FileExecutor.readFile(SettingConfig.getStoragePath(ConfigConsts.TOKEN_OF_SETTINGS));
    JSONArray array = JSON.parseArray(token);
    array.forEach(object -> {
      JSONObject jsonObject = (JSONObject) object;
      tokens.put(jsonObject.getString(ValueConsts.KEY_STRING), jsonObject.getInteger(ValueConsts
          .VALUE_STRING));
    });
  } catch (Exception e) {
    logger.error("load token error: " + e.getMessage());
  }
  return tokens;
}

代码示例来源:origin: code4everything/efo

@Override
public JSONObject remove(JSONObject object) {
  JSONArray array = object.getJSONArray("items");
  array.forEach(file -> FileExecutor.deleteFile(file.toString()));
  return getBasicResponse(ValueConsts.TRUE);
}

代码示例来源:origin: top.wboost/common-utils-web

List<T> returnList = new ArrayList<>();
parseList.forEach((parseObj) -> {
  T parseEntity;

代码示例来源:origin: com.github.calmking/openapi-core

if (event != null) {
  JSONArray sub = condition.getJSONArray("sub");
  sub.forEach((x) -> {
    Map<String, Object> param = new HashMap<>();
    try {
        if (v instanceof JSONArray) {
          ArrayList<HashMap<String, String>> eventList = new ArrayList();
          ((JSONArray) v).forEach((obj) -> {
            HashMap m = new HashMap();
            ((JSONObject) obj).forEach((sk, sv) -> {

代码示例来源:origin: zgqq/mah

final StringBuilder contentsb = new StringBuilder();
if (contentLine != null) {
  contentLine.forEach(str -> contentsb.append(str).append("\n"));

代码示例来源:origin: org.hsweb/hsweb-web-service-simple

columnMetaData.setSortIndex(sortIndex[0]++);
JSONArray obj = ((JSONArray) field);
obj.forEach((defT) -> {
  JSONObject def = ((JSONObject) defT);
  String key = def.getString("key");

代码示例来源:origin: hs-web/hsweb-generator

JSONArray array = meta.getJSONArray("option_list");
  if (array != null)
    array.forEach(comboBox::addItem);
  editor = new DefaultCellEditor(comboBox);
} else {

代码示例来源:origin: PowerShenli/MyDog

private static List<OutputItemDef> parseOutputItemDef(JSONArray itemJsons, ClassLoader classLoader) {
  List<OutputItemDef> outputItemDefList = new ArrayList<>();
  itemJsons.forEach(entry ->{
    JSONObject itemJson = (JSONObject)entry;
    String itemName = itemJson.getString("itemName");

代码示例来源:origin: yuboon/Aooms

JSONArray ids = JSONArray.parseArray(resourceIds);
List<Record> list = Lists.newArrayList();
ids.forEach(id -> {
  Record record = Record.empty();
  record.set(AoomsVar.ID,IDGenerator.getStringValue());
JSONArray ids = JSONArray.parseArray(halfResourceIds);
List<Record> list = Lists.newArrayList();
ids.forEach(id -> {
  Record record = Record.empty();
  record.set(AoomsVar.ID,IDGenerator.getStringValue());

代码示例来源:origin: yuboon/Aooms

private void addRoles(String userId){
  String roleIds = getParaString("roleIds");
  if(StrUtil.isNotBlank(roleIds)){
    JSONArray ids = JSONArray.parseArray(roleIds);
    ids.forEach(id -> {
      Record record = Record.empty();
      record.set(AoomsVar.ID,IDGenerator.getStringValue());
      record.set("user_id",userId);
      record.set("role_id",id);
      record.set("create_time",DateUtil.now());
      db.insert("aooms_rbac_userrole", record);
    });
  }
}

相关文章

微信公众号

最新文章

更多