本文整理了Java中java.util.List.copyOf()
方法的一些代码示例,展示了List.copyOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.copyOf()
方法的具体详情如下:
包路径:java.util.List
类名称:List
方法名:copyOf
暂无
代码示例来源:origin: com.yahoo.vespa/node-repository
public List<Report> getReports() { return List.copyOf(reports.values()); }
代码示例来源:origin: net.dongliu/xhttp
private static Map<String, List<String>> copyCaseInsensitive(Map<String, List<String>> map) {
var newMap = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
for (var entry : map.entrySet()) {
newMap.put(entry.getKey(), List.copyOf(entry.getValue()));
}
return unmodifiableMap(newMap);
}
代码示例来源:origin: net.dongliu/xhttp
/**
* Create request body send x-www-form-encoded data
*/
public static Body<List<Param>> wwwForm(Collection<? extends Param> params, Charset charset) {
return new FormBody(List.copyOf(requireNonNull(params)), charset);
}
代码示例来源:origin: net.dongliu/xhttp
/**
* Create multi-part encoded request body, from several Parts.
*/
public static Body<List<Part>> multiPart(List<Part> parts) {
return new MultiPartBody(List.copyOf(requireNonNull(parts)));
}
代码示例来源:origin: BNYMellon/CodeKatas
public List<Set<Card>> dealHands(Deque<Card> shuffled, int hands, int cardsPerHand)
{
var result = new ArrayList<Set<Card>>();
for (int i = 0; i < hands; i++)
{
result.add(this.deal(shuffled, cardsPerHand));
}
return List.copyOf(result);
}
代码示例来源:origin: BNYMellon/CodeKatas
private Map<Suit,List<Card>> buildCardsAsMapBySuit()
{
var map = new HashMap<Suit, List<Card>>();
for (var card : this.cards)
{
Suit suit = card.getSuit();
List<Card> list = map.computeIfAbsent(suit, k -> new ArrayList<>());
list.add(card);
}
for (var suitListEntry : map.entrySet())
{
var value = suitListEntry.getValue();
Collections.sort(value);
suitListEntry.setValue(List.copyOf(value));
}
return map;
}
代码示例来源: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: BNYMellon/CodeKatas
public JDKImperativeDeckOfCardsAsList()
{
this.cards = List.copyOf(this.buildCardsAsSortedList());
this.cardsBySuit = Map.copyOf(this.buildCardsAsMapBySuit());
}
代码示例来源:origin: com.github.almasb/fxgl-entity
private void onPhysicsEntityAdded(Entity entity) {
if (!jboxWorld.isLocked()) {
createBody(entity);
} else {
delayedBodiesAdd.add(entity);
}
ChangeListener<Number> scaleChangeListener = (observable, oldValue, newValue) -> {
Body b = entity.getComponent(PhysicsComponent.class).body;
if (b != null) {
List<Fixture> fixtures = List.copyOf(b.getFixtures());
forEach(fixtures, b::destroyFixture);
createFixtures(entity);
createSensors(entity);
}
};
// TODO: clean listeners on remove
entity.getTransformComponent().scaleXProperty().addListener(scaleChangeListener);
entity.getTransformComponent().scaleYProperty().addListener(scaleChangeListener);
}
代码示例来源:origin: net.dongliu/xhttp
this.interceptorSuppliers = List.copyOf(clientBuilder.interceptorSuppliers);
内容来源于网络,如有侵权,请联系作者删除!