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:
java.lang.Iterable<java.util.Map.Entry<java.lang.String,T>>
public class KeyValueMap<T> extends Commentable implements java.lang.Iterable<java.util.Map.Entry<java.lang.String,T>>
Helper class to hold key value pairs.
-
-
Constructor Summary
Constructors Constructor Description KeyValueMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the mapT
get(java.lang.String key)
Get an item from the map.boolean
isEmpty()
Check whether this map is empty.java.util.Iterator<java.util.Map.Entry<java.lang.String,T>>
iterator()
void
put(java.lang.String key, T value)
Put an item in the mapvoid
putAll(KeyValueMap<T> map)
Put all items from the other map in this mapT
remove(java.lang.String key)
Remove an item from the mapint
size()
Get the size of the map.java.lang.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
-
-
-
-
Method Detail
-
get
public T get(java.lang.String key)
Get an item from the map.- Parameters:
key
- The key of the item.- Returns:
- The item or
null
.
-
put
public void put(java.lang.String key, T value)
Put an item in the map- Parameters:
key
- The key of the item.value
- The value
-
remove
public T remove(java.lang.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 java.util.Iterator<java.util.Map.Entry<java.lang.String,T>> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
isEmpty
public boolean isEmpty()
Check whether this map is empty.- Returns:
true
if the map is empty.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classCommentable
-
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
-
-