Interface Put<K,V>

Type Parameters:
K - the type of the keys in this map
V - the type of the values in this map
All Known Subinterfaces:
BidiMap<K,V>, BoundedMap<K,V>, IterableMap<K,V>, IterableSortedMap<K,V>, MultiMap<K,V>, OrderedBidiMap<K,V>, OrderedMap<K,V>, SortedBidiMap<K,V>, Trie<K,V>
All Known Implementing Classes:
AbstractBidiMapDecorator, AbstractBitwiseTrie, AbstractDualBidiMap, AbstractHashedMap, AbstractIterableMap, AbstractLinkedMap, AbstractMapDecorator, AbstractOrderedBidiMapDecorator, AbstractOrderedMapDecorator, AbstractPatriciaTrie, AbstractReferenceMap, AbstractSortedBidiMapDecorator, AbstractSortedMapDecorator, CaseInsensitiveMap, CompositeMap, DefaultedMap, DualHashBidiMap, DualLinkedHashBidiMap, DualTreeBidiMap, DualTreeBidiMap.ViewMap, FixedSizeMap, FixedSizeSortedMap, Flat3Map, HashedMap, LazyMap, LazySortedMap, LinkedMap, ListOrderedMap, LRUMap, MultiKeyMap, MultiValueMap, PassiveExpiringMap, PatriciaTrie, PredicatedMap, PredicatedSortedMap, ReferenceIdentityMap, ReferenceMap, SingletonMap, StaticBucketMap, TransformedMap, TransformedSortedMap, TransformedSplitMap, TreeBidiMap, UnmodifiableBidiMap, UnmodifiableMap, UnmodifiableOrderedBidiMap, UnmodifiableOrderedMap, UnmodifiableSortedBidiMap, UnmodifiableSortedMap, UnmodifiableTrie

public interface Put<K,V>
The "write" subset of the Map interface.

NOTE: in the original Map interface, Map.put(Object, Object) is known to have the same return type as Map.get(Object), namely V. Put makes no assumptions in this regard (there is no association with, nor even knowledge of, a "reading" interface) and thus defines put(Object, Object) as returning Object.

Since:
4.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all of the mappings from this map.
    put(K key, V value)
    Associates the specified value with the specified key in this map.
    void
    putAll(Map<? extends K,? extends V> t)
    Copies all of the mappings from the specified map to this map.
  • Method Details

    • clear

      void clear()
      Removes all of the mappings from this map.
      See Also:
    • put

      Object put(K key, V value)
      Associates the specified value with the specified key in this map.

      Note that the return type is Object, rather than V as in the Map interface. See the class Javadoc for further info.

      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)
      See Also:
    • putAll

      void putAll(Map<? extends K,? extends V> t)
      Copies all of the mappings from the specified map to this map.
      Parameters:
      t - mappings to be stored in this map
      See Also: