mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8282662: Use List.of() factory method to reduce memory consumption
Reviewed-by: redestad, rriggs
This commit is contained in:
parent
48f19e43c5
commit
168b226b0f
4 changed files with 10 additions and 11 deletions
|
@ -6760,7 +6760,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
private static List<Class<?>> buildCommonSuffix(List<MethodHandle> init, List<MethodHandle> step, List<MethodHandle> pred, List<MethodHandle> fini, int cpSize) {
|
||||
final List<Class<?>> longest1 = longestParameterList(Stream.of(step, pred, fini).flatMap(List::stream), cpSize);
|
||||
final List<Class<?>> longest2 = longestParameterList(init.stream(), 0);
|
||||
return longestParameterList(Arrays.asList(longest1, longest2));
|
||||
return longestParameterList(List.of(longest1, longest2));
|
||||
}
|
||||
|
||||
private static void loopChecks1b(List<MethodHandle> init, List<Class<?>> commonSuffix) {
|
||||
|
@ -7617,7 +7617,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
// special case; if the iterator handle is null and the body handle
|
||||
// only declares V and T then the external parameter list consists
|
||||
// of Iterable
|
||||
externalParamList = Arrays.asList(Iterable.class);
|
||||
externalParamList = List.of(Iterable.class);
|
||||
iterableType = Iterable.class;
|
||||
} else {
|
||||
// special case; if the iterator handle is null and the external
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -28,8 +28,8 @@ package java.nio.file;
|
|||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.nio.file.FileTreeWalker.Event;
|
||||
|
||||
|
@ -67,7 +67,7 @@ class FileTreeIterator implements Iterator<Event>, Closeable {
|
|||
FileTreeIterator(Path start, int maxDepth, FileVisitOption... options)
|
||||
throws IOException
|
||||
{
|
||||
this.walker = new FileTreeWalker(Arrays.asList(options), maxDepth);
|
||||
this.walker = new FileTreeWalker(List.of(options), maxDepth);
|
||||
this.next = walker.walk(start);
|
||||
assert next.type() == FileTreeWalker.EventType.ENTRY ||
|
||||
next.type() == FileTreeWalker.EventType.START_DIRECTORY;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue