public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(int size) { return new LinkedHashMap<>( getInitialCapacityFromExpectedSize( size ) ); }
public static <T> LinkedHashSet<T> newLinkedHashSet(int size) { return new LinkedHashSet<>( getInitialCapacityFromExpectedSize( size ) ); }
public static <K, V> HashMap<K, V> newHashMap(int size) { return new HashMap<>( getInitialCapacityFromExpectedSize( size ) ); }
public static <T> HashSet<T> newHashSet(int size) { return new HashSet<>( getInitialCapacityFromExpectedSize( size ) ); }
@SafeVarargs public static <T> Set<T> asSet(T... ts) { Set<T> set = new HashSet<>( getInitialCapacityFromExpectedSize( ts.length ) ); Collections.addAll( set, ts ); return set; }
@SafeVarargs public static <T> Set<T> asLinkedHashSet(T... ts) { Set<T> set = new LinkedHashSet<>( getInitialCapacityFromExpectedSize( ts.length ) ); Collections.addAll( set, ts ); return set; }