@Override public HashMap<K, V> put(K key, V value) { return new HashMap<>(trie.put(key, value)); }
/** * Returns a singleton {@code HashMap}, i.e. a {@code HashMap} of one element. * * @param entry A map entry. * @param <K> The key type * @param <V> The value type * @return A new Map containing the given entry */ public static <K, V> HashMap<K, V> of(Tuple2<? extends K, ? extends V> entry) { return new HashMap<>(HashArrayMappedTrie.<K, V> empty().put(entry._1, entry._2)); }
/** * Returns a singleton {@code HashMap}, i.e. a {@code HashMap} of one element. * * @param key A singleton map key. * @param value A singleton map value. * @param <K> The key type * @param <V> The value type * @return A new Map containing the given entry */ public static <K, V> HashMap<K, V> of(K key, V value) { return new HashMap<>(HashArrayMappedTrie.<K, V> empty().put(key, value)); }
private static <K, V> HashMap<K, V> wrap(HashArrayMappedTrie<K, V> trie) { return trie.isEmpty() ? empty() : new HashMap<>(trie); }
@Override public HashMap<K, V> put(K key, V value) { return new HashMap<>(trie.put(key, value)); }
/** * Returns a singleton {@code HashMap}, i.e. a {@code HashMap} of one element. * * @param key A singleton map key. * @param value A singleton map value. * @param <K> The key type * @param <V> The value type * @return A new Map containing the given entry */ public static <K, V> HashMap<K, V> of(K key, V value) { return new HashMap<>(HashArrayMappedTrie.<K, V> empty().put(key, value)); }
/** * Returns a singleton {@code HashMap}, i.e. a {@code HashMap} of one element. * * @param entry A map entry. * @param <K> The key type * @param <V> The value type * @return A new Map containing the given entry */ public static <K, V> HashMap<K, V> of(Tuple2<? extends K, ? extends V> entry) { return new HashMap<>(HashArrayMappedTrie.<K, V> empty().put(entry._1, entry._2)); }
private static <K, V> HashMap<K, V> wrap(HashArrayMappedTrie<K, V> trie) { return trie.isEmpty() ? empty() : new HashMap<>(trie); }