@ SafeVarargs public static < T > Set < T > asSet ( T ... ts ) { if ( ts == null ) { return null ; } else if ( ts . length == 0 ) { return Collections . emptySet ( ) ; } else { Set < T > set = new HashSet < T > ( getInitialCapacityFromExpectedSize ( ts . length ) ) ; Collections . addAll ( set , ts ) ; return Collections . unmodifiableSet ( set ) ; } }
Returns an unmodifiable set containing the given elements .