diff --git a/api/src/main/java/io/jsonwebtoken/lang/Collections.java b/api/src/main/java/io/jsonwebtoken/lang/Collections.java index 01768fc64..ead04ac3e 100644 --- a/api/src/main/java/io/jsonwebtoken/lang/Collections.java +++ b/api/src/main/java/io/jsonwebtoken/lang/Collections.java @@ -86,19 +86,16 @@ public static List of(T... elements) { /** * Returns the specified collection as a {@link Set} instance. * - * @param c the collection to represent as a set + * @param c the collection to be converted * @param collection element type - * @return a type-safe immutable {@code Set} containing the specified collection elements. + * @return a type-safe immutable {@code Set} containing the specified collection elements. * @since 0.12.0 */ public static Set asSet(Collection c) { - if (c instanceof Set) { - return (Set) c; - } if (isEmpty(c)) { return java.util.Collections.emptySet(); } - return java.util.Collections.unmodifiableSet(new LinkedHashSet<>(c)); + return java.util.Collections.unmodifiableSet(new LinkedHashSet(c)); } /**