Skip to content

Commit 0b5216a

Browse files
Ian GravesAlexey Semenyuk
authored andcommitted
8263545: Convert jpackage to use Stream.toList()
Reviewed-by: asemenyuk, almatvee
1 parent ed701ea commit 0b5216a

File tree

17 files changed

+44
-46
lines changed

17 files changed

+44
-46
lines changed

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/DesktopIntegration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@ static DesktopIntegration create(PlatformPackage thePackage,
175175
List<String> requiredPackages() {
176176
return Stream.of(List.of(this), nestedIntegrations).flatMap(
177177
List::stream).map(DesktopIntegration::requiredPackagesSelf).flatMap(
178-
List::stream).distinct().collect(Collectors.toList());
178+
List::stream).distinct().toList();
179179
}
180180

181181
Map<String, String> create() throws IOException {
@@ -525,7 +525,7 @@ private static String stringifyShellCommands(String... commands) {
525525

526526
private static String stringifyShellCommands(List<String> commands) {
527527
return String.join(System.lineSeparator(), commands.stream().filter(
528-
s -> s != null && !s.isEmpty()).collect(Collectors.toList()));
528+
s -> s != null && !s.isEmpty()).toList());
529529
}
530530

531531
private static class LinuxFileAssociation {

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@ List<String> execute(Path root) throws IOException {
8181
List<String> packageNames = Collections.emptyList();
8282
return packageNames;
8383
}
84-
}).flatMap(List::stream).sorted().distinct().collect(Collectors.toList());
84+
}).flatMap(List::stream).sorted().distinct().toList();
8585

8686
return neededPackages;
8787
}

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -173,7 +173,7 @@ public void doValidate(Map<String, ? super Object> params)
173173
protected List<ToolValidator> getToolValidators(
174174
Map<String, ? super Object> params) {
175175
return Stream.of(TOOL_DPKG_DEB, TOOL_DPKG, TOOL_FAKEROOT).map(
176-
ToolValidator::new).collect(Collectors.toList());
176+
ToolValidator::new).toList();
177177
}
178178

179179
@Override

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBundler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -205,8 +205,7 @@ private List<String> getListOfNeededPackages(
205205
// Merge all package lists together.
206206
// Filter out empty names, sort and remove duplicates.
207207
List<String> result = Stream.of(xdgUtilsPackage, neededLibPackages).flatMap(
208-
List::stream).filter(Predicate.not(String::isEmpty)).sorted().distinct().collect(
209-
Collectors.toList());
208+
List::stream).filter(Predicate.not(String::isEmpty)).sorted().distinct().toList();
210209

211210
Log.verbose(String.format("Required packages: %s", result));
212211

src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@ List<Path> expandFileset(Path root) throws IOException {
8080
if (!Files.isSymbolicLink(root)) {
8181
if (Files.isDirectory(root)) {
8282
try (Stream<Path> stream = Files.list(root)) {
83-
List<Path> children = stream.collect(Collectors.toList());
83+
List<Path> children = stream.toList();
8484
if (children != null && children.size() > 0) {
8585
children.forEach(f -> {
8686
try {

src/jdk.jpackage/share/classes/jdk/jpackage/internal/DottedVersion.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -148,8 +148,7 @@ private static BigInteger[] parseVersionString(String version, boolean greedy) {
148148
if (components.isEmpty()) {
149149
components.add(BigInteger.ZERO);
150150
}
151-
return components.stream()
152-
.collect(Collectors.toList()).toArray(BigInteger[]::new);
151+
return components.toArray(BigInteger[]::new);
153152
}
154153

155154
@Override

src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -148,7 +148,7 @@ int execute() throws IOException {
148148

149149
if ((outputConsumer != null || Log.isVerbose())
150150
|| saveOutput) {
151-
savedOutput = br.lines().collect(Collectors.toList());
151+
savedOutput = br.lines().toList();
152152
} else {
153153
savedOutput = null;
154154
}

src/jdk.jpackage/share/classes/jdk/jpackage/internal/FileAssociation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@ static List<FileAssociation> fetchFrom(Map<String, ? super Object> params) {
9595
}
9696

9797
return assoc;
98-
}).collect(Collectors.toList());
98+
}).toList();
9999
}
100100

101101
Path launcherPath;

src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ private void initClasspath(Map<String, ? super Object> params)
238238
.relativize(p.toAbsolutePath()))
239239
.collect(Collectors.toSet());
240240
jars.remove(mainJarName);
241-
classPath = jars.stream().sorted().collect(Collectors.toList());
241+
classPath = jars.stream().sorted().toList();
242242
}
243243
}
244244
}

src/jdk.jpackage/share/classes/jdk/jpackage/internal/OverridableResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -103,7 +103,7 @@ enum Source { External, ResourceDir, DefaultResource };
103103
OverridableResource setSourceOrder(Source... v) {
104104
sources = Stream.of(v)
105105
.map(source -> Map.entry(source, getHandler(source)))
106-
.collect(Collectors.toList());
106+
.toList();
107107
return this;
108108
}
109109

0 commit comments

Comments
 (0)