ch.lambdaj.Lambda.by()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(256)

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

Lambda.by介绍

[英]Creates a GroupCondition that allows to group items based on the value they have on a given argument
[中]创建一个GroupCondition,该条件允许根据项目在给定参数上的值对项目进行分组

代码示例

代码示例来源:origin: CloudSlang/score

private List<Message> optimize(List<Message> messages){
  long t = System.currentTimeMillis();
  List<Message> result = new ArrayList<>();
  Group<Message> groups = group(messages, by(on(Message.class).getId()));
  for (Group<Message> group :groups.subgroups()){
    result.addAll(group.first().shrink(group.findAll()));
  }
  if (logger.isDebugEnabled()) logger.debug("bulk optimization result: " + messages.size() + " -> " + result.size() + " in " + (System.currentTimeMillis()-t) + " ms");
  return result;
}

代码示例来源:origin: io.openscore/score-worker-manager-impl

private List<Message> optimize(List<Message> messages){
  long t = System.currentTimeMillis();
  List<Message> result = new ArrayList<>();
  Group<Message> groups = group(messages, by(on(Message.class).getId()));
  for (Group<Message> group :groups.subgroups()){
    result.addAll(group.first().shrink(group.findAll()));
  }
  if (logger.isDebugEnabled()) logger.debug("bulk optimization result: " + messages.size() + " -> " + result.size() + " in " + (System.currentTimeMillis()-t) + " ms");
  return result;
}

代码示例来源:origin: CloudSlang/cloud-slang

public Map<String, List<StepData>> aggregate() {
  Map<String, List<StepData>> branchesDataByPath = new HashMap<>();
  Group<LanguageEventData> groups = group(getEvents(), by(on(LanguageEventData.class).getPath()));
  for (Group<LanguageEventData> subGroup : groups.subgroups()) {
    List<StepData> branchesData = buildBranchesData(subGroup.findAll());
    branchesDataByPath.put(branchesData.get(0).getPath(), branchesData);
  }
  return branchesDataByPath;
}

代码示例来源:origin: CloudSlang/cloud-slang

public Map<String, StepData> aggregate() {
  Map<String, StepData> joinDataByPath = new HashMap<>();
  Group<LanguageEventData> groups = group(getEvents(), by(on(LanguageEventData.class).getPath()));
  for (Group<LanguageEventData> subGroup : groups.subgroups()) {
    StepData joinData = buildPublishAggregateData(subGroup.first());
    joinDataByPath.put(joinData.getPath(), joinData);
  }
  return joinDataByPath;
}

代码示例来源:origin: CloudSlang/cloud-slang

public Map<String, StepData> aggregate() {
  Map<String, StepData> stepsData = new HashMap<>();
  Group<LanguageEventData> groups = group(getEvents(), by(on(LanguageEventData.class).getPath()));
  for (Group<LanguageEventData> subGroup : groups.subgroups()) {
    StepData stepData = buildStepData(subGroup.findAll());
    stepsData.put(stepData.getPath(), stepData);
  }
  return stepsData;
}

相关文章