Top Description Methods
org.apache.commons.collections4

public Interface Put<K, V>

Known Direct Subinterfaces
org.apache.commons.collections4.IterableMap
Known Direct Implementers
org.apache.commons.collections4.SplitMapUtils.WrappedPut, org.apache.commons.collections4.splitmap.TransformedSplitMap
Type Parameters
<K>
the type of the keys in this map
<V>
the type of the values in this map
Imports
java.util.Map

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
Get

Method Summary

Modifier and TypeMethod and Description
public void
public Object

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.)
put
(K
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
value
)

Note that the return type is Object, rather than V as in the Map interface.

public void
putAll(Map<? extends K, ? extends V>
mappings to be stored in this map
t
)

Method Detail

clearback to summary
public void clear()
See Also
Map#clear()
putback to summary
public Object put(K key, V value)

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

Parameters
key:K

key with which the specified value is to be associated

value:V

value to be associated with the specified key

Returns:Object

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
Map#put(Object, Object)
putAllback to summary
public void putAll(Map<? extends K, ? extends V> t)
Parameters
t:Map<? extends K, ? extends V>

mappings to be stored in this map

See Also
Map#putAll(Map)