Use Set.of instead of HashSet with Arrays.asList
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import java.security.Principal;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
@@ -73,6 +72,7 @@ public abstract class RequestPredicates {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(RequestPredicates.class);
|
||||
|
||||
|
||||
/**
|
||||
* Return a {@code RequestPredicate} that always matches.
|
||||
* @return a predicate that always matches
|
||||
@@ -537,7 +537,6 @@ public abstract class RequestPredicates {
|
||||
public String toString() {
|
||||
return this.pattern.getPatternString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -566,12 +565,13 @@ public abstract class RequestPredicates {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ContentTypePredicate extends HeadersPredicate {
|
||||
|
||||
private final Set<MediaType> mediaTypes;
|
||||
|
||||
public ContentTypePredicate(MediaType... mediaTypes) {
|
||||
this(new HashSet<>(Arrays.asList(mediaTypes)));
|
||||
this(Set.of(mediaTypes));
|
||||
}
|
||||
|
||||
private ContentTypePredicate(Set<MediaType> mediaTypes) {
|
||||
@@ -603,12 +603,13 @@ public abstract class RequestPredicates {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class AcceptPredicate extends HeadersPredicate {
|
||||
|
||||
private final Set<MediaType> mediaTypes;
|
||||
|
||||
public AcceptPredicate(MediaType... mediaTypes) {
|
||||
this(new HashSet<>(Arrays.asList(mediaTypes)));
|
||||
this(Set.of(mediaTypes));
|
||||
}
|
||||
|
||||
private AcceptPredicate(Set<MediaType> mediaTypes) {
|
||||
@@ -698,7 +699,6 @@ public abstract class RequestPredicates {
|
||||
this.extension :
|
||||
this.extensionPredicate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -809,6 +809,7 @@ public abstract class RequestPredicates {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link RequestPredicate} that negates a delegate predicate.
|
||||
*/
|
||||
@@ -851,6 +852,7 @@ public abstract class RequestPredicates {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link RequestPredicate} where either {@code left} or {@code right} predicates
|
||||
* may match.
|
||||
@@ -1094,7 +1096,6 @@ public abstract class RequestPredicates {
|
||||
public String toString() {
|
||||
return method() + " " + path();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user