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

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

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

Lambda.max介绍

[英]Finds the maximum item in the given iterable. Actually it handles also Maps, Arrays and Iterator by collecting their values. Note that this method accepts an Object in order to be used in conjunction with the Lambda#forEach(Iterable).
[中]查找给定iterable中的最大项。实际上,它还通过收集映射、数组和迭代器的值来处理它们。请注意,此方法接受一个对象,以便与Lambda#forEach(Iterable)一起使用。

代码示例

代码示例来源:origin: io.openscore.lang/score-lang-compiler

private Long getCurrentId(Map<String, Long> taskReferences) {
  Long max = Lambda.max(taskReferences);
  return max + NUMBER_OF_TASK_EXECUTION_STEPS;
}

代码示例来源:origin: mariofusco/lambdaj

/**
 * Finds the maximum item in this iterable defined by the given argument.
 * @param argument An argument defined using the {@link Lambda#on(Class)} method
 * @return The maximum of all the Object in the given iterable
 */
public <A> A max(A argument) {
  return Lambda.max(getInner(), argument);
}

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

protected static String resolveDotNetVersion() {
  File dotNetHome = new File(DOTNET_PATH);
  if(dotNetHome.isDirectory()) {
    File[] versionFolders = dotNetHome.listFiles(new FileFilter() {
      @Override
      public boolean accept(File file) {
        return file.isDirectory() && file.getName().startsWith("v");
      }
    });
    if(!ArrayUtils.isEmpty(versionFolders)) {
      String maxVersion = max(versionFolders, on(File.class).getName()).substring(1);
      return maxVersion.substring(0, 1) + ".x";
    }
  }
  return "N/A";
}

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

protected static String resolveDotNetVersion() {
  File dotNetHome = new File(DOTNET_PATH);
  if(dotNetHome.isDirectory()) {
    File[] versionFolders = dotNetHome.listFiles(new FileFilter() {
      @Override
      public boolean accept(File file) {
        return file.isDirectory() && file.getName().startsWith("v");
      }
    });
    if(!ArrayUtils.isEmpty(versionFolders)) {
      String maxVersion = max(versionFolders, on(File.class).getName()).substring(1);
      return maxVersion.substring(0, 1) + ".x";
    }
  }
  return "N/A";
}

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

private long getCurrentId(Map<String, Long> stepReferences, Deque<Step> steps) {
  Long currentId;
  long max = Lambda.max(stepReferences);
  Map.Entry maxEntry = selectFirst(stepReferences.entrySet(),
      having(on(Map.Entry.class).getValue(), equalTo(max)));
  String referenceKey = (String) (maxEntry).getKey();
  Step step = null;
  for (Step stepItem : steps) {
    if (stepItem.getName().equals(referenceKey)) {
      step = stepItem;
      break;
    }
  }
  if (step == null || !step.isParallelLoop()) {
    // the reference is not a step or is not a parallel loop step
    currentId = max + NUMBER_OF_STEP_EXECUTION_STEPS;
  } else {
    //async step
    currentId = max + NUMBER_OF_STEP_EXECUTION_STEPS + NUMBER_OF_PARALLEL_LOOP_EXECUTION_STEPS;
  }
  return currentId;
}

代码示例来源:origin: io.cloudslang.lang/cloudslang-compiler

private long getCurrentId(Map<String, Long> stepReferences, Deque<Step> steps) {
  Long currentId;
  long max = Lambda.max(stepReferences);
  Map.Entry maxEntry = selectFirst(stepReferences.entrySet(),
      having(on(Map.Entry.class).getValue(), equalTo(max)));
  String referenceKey = (String) (maxEntry).getKey();
  Step step = null;
  for (Step stepItem : steps) {
    if (stepItem.getName().equals(referenceKey)) {
      step = stepItem;
      break;
    }
  }
  if (step == null || !step.isParallelLoop()) {
    // the reference is not a step or is not a parallel loop step
    currentId = max + NUMBER_OF_STEP_EXECUTION_STEPS;
  } else {
    //async step
    currentId = max + NUMBER_OF_STEP_EXECUTION_STEPS + NUMBER_OF_PARALLEL_LOOP_EXECUTION_STEPS;
  }
  return currentId;
}

相关文章