org.apache.sling.provisioning.model

## Class KeyValueMap<T>

- java.lang.Object
- - org.apache.sling.provisioning.model.Traceable
  - - org.apache.sling.provisioning.model.Commentable
    - - org.apache.sling.provisioning.model.KeyValueMap<T>

All Implemented Interfaces:
  Iterable<Map.Entry<String,T>>

    public class KeyValueMap<T>
    extends Commentable
    implements Iterable<Map.Entry<String,T>>

Helper class to hold key value pairs.

### Constructor Summary

Constructors
Constructor and Description
`KeyValueMap()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clear()` Clear the map
`T` `get(String key)` Get an item from the map.
`boolean` `isEmpty()` Check whether this map is empty.
`Iterator<Map.Entry<String,T>>` `iterator()`
`void` `put(String key, T value)` Put an item in the map
`void` `putAll(KeyValueMap<T> map)` Put all items from the other map in this map
`T` `remove(String key)` Remove an item from the map
`int` `size()` Get the size of the map.
`String` `toString()`

### Methods inherited from class org.apache.sling.provisioning.model.Commentable

`getComment, setComment`

### Methods inherited from class org.apache.sling.provisioning.model.Traceable

`getLocation, setLocation`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### KeyValueMap

    public KeyValueMap()

### Method Detail

#### get

    public T get(String key)

Get an item from the map.

Parameters:
  `key` - The key of the item.
Returns:
  The item or `null`.

#### put

    public void put(String key,
                    T value)

Put an item in the map

Parameters:
  `key` - The key of the item.
  `value` - The value

#### remove

    public T remove(String key)

Remove an item from the map

Parameters:
  `key` - The key of the item.
Returns:
  The previously stored value for the key or `null`.
Since:
  1.1

#### putAll

    public void putAll(KeyValueMap<T> map)

Put all items from the other map in this map

Parameters:
  `map` - The other map

#### iterator

    public Iterator<Map.Entry<String,T>> iterator()

Specified by:
  `iterator` in interface `Iterable<Map.Entry<String,T>>`

#### isEmpty

    public boolean isEmpty()

Check whether this map is empty.

Returns:
  `true` if the map is empty.

#### toString

    public String toString()

Overrides:
  `toString` in class `Commentable`

#### size

    public int size()

Get the size of the map.

Returns:
  The size of the map.
Since:
  1.1

#### clear

    public void clear()

Clear the map

Since:
  1.7