Interface ReadOnlyStringMap
- 
- All Superinterfaces:
- Serializable
 - All Known Subinterfaces:
- IndexedReadOnlyStringMap,- IndexedStringMap,- StringMap
 - All Known Implementing Classes:
- DefaultThreadContextMap,- SortedArrayStringMap
 
 public interface ReadOnlyStringMap extends Serializable A read-only collection of String keys mapped to values of arbitrary type.- Since:
- 2.7
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsKey(String key)Returnstrueif this data structure contains the specified key,falseotherwise.<V> voidforEach(BiConsumer<String,? super V> action)Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.<V,S>
 voidforEach(TriConsumer<String,? super V,S> action, S state)Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.<V> VgetValue(String key)Returns the value for the specified key, ornullif the specified key does not exist in this collection.booleanisEmpty()Returnstrueif this collection is empty (size is zero),falseotherwise.intsize()Returns the number of key-value pairs in this collection.Map<String,String>toMap()Returns a non-nullmutableMap<String, String>containing a snapshot of this data structure.
 
- 
- 
- 
Method Detail- 
toMapMap<String,String> toMap() Returns a non-nullmutableMap<String, String>containing a snapshot of this data structure.- Returns:
- a mutable copy of this data structure in Map<String, String>form.
 
 - 
containsKeyboolean containsKey(String key) Returnstrueif this data structure contains the specified key,falseotherwise.- Parameters:
- key- the key whose presence to check. May be- null.
- Returns:
- trueif this data structure contains the specified key,- falseotherwise.
 
 - 
forEach<V> void forEach(BiConsumer<String,? super V> action) Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.Some implementations may not support structural modifications (adding new elements or removing elements) while iterating over the contents. In such implementations, attempts to add or remove elements from the BiConsumer'sBiConsumer.accept(Object, Object)accept} method may cause aConcurrentModificationExceptionto be thrown.- Type Parameters:
- V- type of the value.
- Parameters:
- action- The action to be performed for each key-value pair in this collection.
- Throws:
- ConcurrentModificationException- some implementations may not support structural modifications to this data structure while iterating over the contents with- forEach(BiConsumer)or- forEach(TriConsumer, Object).
 
 - 
forEach<V,S> void forEach(TriConsumer<String,? super V,S> action, S state) Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.The third parameter lets callers pass in a stateful object to be modified with the key-value pairs, so the TriConsumer implementation itself can be stateless and potentially reusable. Some implementations may not support structural modifications (adding new elements or removing elements) while iterating over the contents. In such implementations, attempts to add or remove elements from the TriConsumer'sacceptmethod may cause aConcurrentModificationExceptionto be thrown.- Type Parameters:
- V- type of the value.
- S- type of the third parameter.
- Parameters:
- action- The action to be performed for each key-value pair in this collection.
- state- the object to be passed as the third parameter to each invocation on the specified triconsumer.
- Throws:
- ConcurrentModificationException- some implementations may not support structural modifications to this data structure while iterating over the contents with- forEach(BiConsumer)or- forEach(TriConsumer, Object).
 
 - 
getValue<V> V getValue(String key) Returns the value for the specified key, ornullif the specified key does not exist in this collection.- Parameters:
- key- the key whose value to return.
- Returns:
- the value for the specified key or null.
 
 - 
isEmptyboolean isEmpty() Returnstrueif this collection is empty (size is zero),falseotherwise.- Returns:
- trueif this collection is empty (size is zero).
 
 - 
sizeint size() Returns the number of key-value pairs in this collection.- Returns:
- the number of key-value pairs in this collection.
 
 
- 
 
-