8134373: use collections convenience factories in the JDK

Reviewed-by: scolebourne, prappo, dfuchs, redestad, smarks
This commit is contained in:
Jonathan Bluett-Duncan 2016-10-12 11:54:38 -07:00 committed by Stuart Marks
parent 8c7dc29389
commit a19fc7fbdb
19 changed files with 67 additions and 100 deletions

View file

@ -33,7 +33,6 @@ import java.nio.file.Paths;
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -333,7 +332,7 @@ public interface ModuleFinder {
*
* <p> When locating modules then any exceptions or errors thrown by the
* {@code find} or {@code findAll} methods of the underlying module finders
* will be propogated to the caller of the resulting module finder's
* will be propagated to the caller of the resulting module finder's
* {@code find} or {@code findAll} methods. </p>
*
* @param finders
@ -342,8 +341,8 @@ public interface ModuleFinder {
* @return A {@code ModuleFinder} that composes a sequence of module finders
*/
static ModuleFinder compose(ModuleFinder... finders) {
final List<ModuleFinder> finderList = Arrays.asList(finders);
finderList.forEach(Objects::requireNonNull);
// copy the list, also checking for nulls
final List<ModuleFinder> finderList = List.of(finders);
return new ModuleFinder() {
private final Map<String, ModuleReference> nameToModule = new HashMap<>();