8277535: Remove redundant Stream.distinct()/sorted() steps

Reviewed-by: prappo
This commit is contained in:
Andrey Turbanov 2022-01-20 18:11:55 +00:00
parent d48279b0bf
commit 3419ff7ba7
3 changed files with 2 additions and 6 deletions
src
java.base/share/classes/jdk/internal/module
jdk.jdeps/share/classes/com/sun/tools/jdeps
jdk.jlink/share/classes/jdk/tools/jmod

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@ -527,7 +527,6 @@ public class ModulePath implements ModuleFinder {
Set<String> packages = classFiles.stream()
.map(this::toPackageName)
.flatMap(Optional::stream)
.distinct()
.collect(Collectors.toSet());
// all packages are exported and open

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
@ -65,7 +65,6 @@ public class ModuleDotGraph {
this(config,
config.rootModules().stream()
.map(Module::name)
.sorted()
.collect(toMap(Function.identity(), mn -> config.resolve(Set.of(mn)))),
apiOnly);
}

@ -690,7 +690,6 @@ public class JmodTask {
.filter(path -> isResource(path.toString()))
.map(path -> toPackageName(path))
.filter(pkg -> pkg.length() > 0)
.distinct()
.collect(Collectors.toSet());
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
@ -705,7 +704,6 @@ public class JmodTask {
.filter(e -> !e.isDirectory() && isResource(e.getName()))
.map(e -> toPackageName(e))
.filter(pkg -> pkg.length() > 0)
.distinct()
.collect(Collectors.toSet());
}