java.util.Map.copyOf()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(375)

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

Map.copyOf介绍

暂无

代码示例

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

public CategorySettings copy() {
  CategorySettings categorySettings = new CategorySettings();
  categorySettings.categories = List.copyOf(categories);
  categorySettings.processToCategoryMap = Map.copyOf(processToCategoryMap);
  categorySettings.nodeToCategoryMap = nodeToCategoryMap
      .entrySet()
      .stream()
      .map(e -> new AbstractMap.SimpleImmutableEntry<>(e.getKey(), Map.copyOf(e.getValue())))
      .collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, Map.Entry::getValue));
  return categorySettings;
}

代码示例来源:origin: com.javax0.geci/javageci-tools

private static CompoundParams getParameters(String generatorMnemonic, String string) {
  if (string.startsWith(generatorMnemonic + " ")) {
    var parametersString = string.substring(generatorMnemonic.length() + 1);
    return new CompoundParams(generatorMnemonic, Map.copyOf(getParameters(parametersString)));
  } else if (string.equals(generatorMnemonic)) {
    return new CompoundParams(generatorMnemonic, Map.of());
  } else {
    return null;
  }
}

代码示例来源:origin: BNYMellon/CodeKatas

public JDKImperativeDeckOfCardsAsList()
{
  this.cards = List.copyOf(this.buildCardsAsSortedList());
  this.cardsBySuit = Map.copyOf(this.buildCardsAsMapBySuit());
}

相关文章