mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8266155: Convert java.base to use Stream.toList()
Reviewed-by: bpb, naoto, iris, chegar
This commit is contained in:
parent
c36c63a008
commit
dd05158b24
8 changed files with 14 additions and 25 deletions
|
@ -3824,7 +3824,7 @@ public final class String
|
|||
}
|
||||
char lastChar = charAt(length - 1);
|
||||
boolean optOut = lastChar == '\n' || lastChar == '\r';
|
||||
List<String> lines = lines().collect(Collectors.toList());
|
||||
List<String> lines = lines().toList();
|
||||
final int outdent = optOut ? 0 : outdent(lines);
|
||||
return lines.stream()
|
||||
.map(line -> {
|
||||
|
|
|
@ -59,7 +59,6 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.lang.invoke.LambdaForm.BasicType.V_TYPE;
|
||||
|
@ -6649,8 +6648,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
iterationVariableTypes.add(in == null ? st.type().returnType() : in.type().returnType());
|
||||
}
|
||||
}
|
||||
final List<Class<?>> commonPrefix = iterationVariableTypes.stream().filter(t -> t != void.class).
|
||||
collect(Collectors.toList());
|
||||
final List<Class<?>> commonPrefix = iterationVariableTypes.stream().filter(t -> t != void.class).toList();
|
||||
|
||||
// Step 1B: determine loop parameters (A...).
|
||||
final List<Class<?>> commonSuffix = buildCommonSuffix(init, step, pred, fini, commonPrefix.size());
|
||||
|
@ -6779,11 +6777,11 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
int pc = h.type().parameterCount();
|
||||
int tpsize = targetParams.size();
|
||||
return pc < tpsize ? dropArguments0(h, pc, targetParams.subList(pc, tpsize)) : h;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private static List<MethodHandle> fixArities(List<MethodHandle> hs) {
|
||||
return hs.stream().map(MethodHandle::asFixedArity).collect(Collectors.toList());
|
||||
return hs.stream().map(MethodHandle::asFixedArity).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,6 @@ import java.util.concurrent.ConcurrentMap;
|
|||
import java.util.jar.JarEntry;
|
||||
import java.util.spi.ResourceBundleControlProvider;
|
||||
import java.util.spi.ResourceBundleProvider;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.internal.loader.BootLoader;
|
||||
|
@ -1514,13 +1513,10 @@ public abstract class ResourceBundle {
|
|||
|
||||
private static class ResourceBundleControlProviderHolder {
|
||||
private static final PrivilegedAction<List<ResourceBundleControlProvider>> pa =
|
||||
() -> {
|
||||
return Collections.unmodifiableList(
|
||||
ServiceLoader.load(ResourceBundleControlProvider.class,
|
||||
ClassLoader.getSystemClassLoader()).stream()
|
||||
.map(ServiceLoader.Provider::get)
|
||||
.collect(Collectors.toList()));
|
||||
};
|
||||
() -> ServiceLoader.load(ResourceBundleControlProvider.class,
|
||||
ClassLoader.getSystemClassLoader()).stream()
|
||||
.map(ServiceLoader.Provider::get)
|
||||
.toList();
|
||||
|
||||
private static final List<ResourceBundleControlProvider> CONTROL_PROVIDERS =
|
||||
AccessController.doPrivileged(pa);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue