/** * Creates new {@link HashMap} with expected size. * * @param expSize Expected size of created map. * @param <K> Type of map keys. * @param <V> Type of map values. * @return New map. */ public static <K, V> HashMap<K, V> newHashMap(int expSize) { return new HashMap<>(capacity(expSize)); }
/** * Creates new {@link LinkedHashMap} with expected size. * * @param expSize Expected size of created map. * @param <K> Type of map keys. * @param <V> Type of map values. * @return New map. */ public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(int expSize) { return new LinkedHashMap<>(capacity(expSize)); }
/** * Creates new {@link LinkedHashSet} with expected size. * * @param expSize Expected size of created map. * @param <T> Type of elements. * @return New set. */ public static <T> LinkedHashSet<T> newLinkedHashSet(int expSize) { return new LinkedHashSet<>(capacity(expSize)); }
/** * Creates new {@link HashSet} with expected size. * * @param expSize Expected size of created map. * @param <T> Type of elements. * @return New set. */ public static <T> HashSet<T> newHashSet(int expSize) { return new HashSet<>(capacity(expSize)); }
/** * Creates new map that limited by size. * * @param limit Limit for size. */ public static <K, V> Map<K, V> limitedMap(int limit) { if (limit == 0) return Collections.emptyMap(); if (limit < 5) return new GridLeanMap<>(limit); return new HashMap<>(capacity(limit), 0.75f); }
map = new Map5<>(); else map = new LeanHashMap<>(IgniteUtils.capacity(size), 0.75f);
/** * Creates new {@link HashMap} with expected size. * * @param expSize Expected size of created map. * @param <K> Type of map keys. * @param <V> Type of map values. * @return New map. */ public static <K, V> HashMap<K, V> newHashMap(int expSize) { return new HashMap<>(capacity(expSize)); }
/** * Creates new {@link LinkedHashMap} with expected size. * * @param expSize Expected size of created map. * @param <K> Type of map keys. * @param <V> Type of map values. * @return New map. */ public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(int expSize) { return new LinkedHashMap<>(capacity(expSize)); }
/** * Creates new {@link HashSet} with expected size. * * @param expSize Expected size of created map. * @param <T> Type of elements. * @return New set. */ public static <T> HashSet<T> newHashSet(int expSize) { return new HashSet<>(capacity(expSize)); }
/** * Creates new {@link LinkedHashSet} with expected size. * * @param expSize Expected size of created map. * @param <T> Type of elements. * @return New set. */ public static <T> LinkedHashSet<T> newLinkedHashSet(int expSize) { return new LinkedHashSet<>(capacity(expSize)); }
/** * Creates new map that limited by size. * * @param limit Limit for size. */ public static <K, V> Map<K, V> limitedMap(int limit) { if (limit == 0) return Collections.emptyMap(); if (limit < 5) return new GridLeanMap<>(limit); return new HashMap<>(capacity(limit), 0.75f); }
map = new Map5<>(); else map = new LeanHashMap<>(IgniteUtils.capacity(size), 0.75f);