Package org.jppf.utils
Class ResultsMap<K,V>
java.lang.Object
org.jppf.utils.ResultsMap<K,V>
- Type Parameters:
K- the type of the keys in this map.V- the type of non-exceptional values in this map.
- All Implemented Interfaces:
Serializable
This class provides convenient methods to inspect and access a mapping of
InvocationResult instances to specified keys.- Author:
- Laurent Cohen
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(K key) Determines whether this map contains an entry for the specified key.entrySet()Get the entry set for all wrapped entries in this map.Get the unwrapped exceptions of all entries in this map with an exceptional result.Get the entry set for all unwrapped exceptions in this map.voidforEach(BiConsumer<K, InvocationResult<V>> action) Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.Get the value of the entry with the specified key.getException(K key) Get the unwrapped exception of the entry with the specified key.Get the unwrapped value of the entry with the specified key.booleanisEmpty()Determine whether this map is empty.keySet()Get the set of all keys in this map.Add an entry with an exceptional value to this map.put(K key, InvocationResult<V> value) Add an entry to this map.Add an entry to this map.results()Get the unwrapped results of all entries in this map with a non-exception result.Get the entry set for all unwrapped non-exception results in this map.intsize()values()Get the values of all entries in this map.
-
Constructor Details
-
ResultsMap
public ResultsMap()
-
-
Method Details
-
put
Add an entry to this map.- Parameters:
key- the entry key.value- the entry's value.- Returns:
- the value previously mapped to the key, or
nullif there wasn't any.
-
put
Add an entry with an exceptional value to this map.- Parameters:
key- the entry key.exception- the value as anException.- Returns:
- the value previously mapped to the key, or
nullif there wasn't any.
-
put
Add an entry to this map.- Parameters:
key- the entry key.value- the entry's value.- Returns:
- the value previously mapped to the key, or
nullif there wasn't any.
-
get
Get the value of the entry with the specified key.- Parameters:
key- the key to look for.- Returns:
- an
InvocationResultif one is mapped to the key,nullotherwise.
-
getResult
Get the unwrapped value of the entry with the specified key.- Parameters:
key- the key to look for.- Returns:
- the value for the key, if an entry is mapped to the key, or
nullif there is no entry for the key or if the entry has an exception result.
-
getException
Get the unwrapped exception of the entry with the specified key.- Parameters:
key- the key to look for.- Returns:
- the exception for the key, if an entry is mapped to the key, or
nullif there is no entry for the key or if the entry has a non-exception result.
-
containsKey
Determines whether this map contains an entry for the specified key.- Parameters:
key- the key to look for.- Returns:
trueif there is an entry for the key,falseotherwise.
-
entrySet
Get the entry set for all wrapped entries in this map.- Returns:
- a set of entries mapping the keys in this map to the corresponding
InvocationResults.
-
resultsEntrySet
Get the entry set for all unwrapped non-exception results in this map.- Returns:
- a set of entries mapping the keys in this map to the corresponding unwrapped result.
-
exceptionsEntrySet
Get the entry set for all unwrapped exceptions in this map.- Returns:
- a set of entries mapping the keys in this map to the corresponding exception.
-
forEach
Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.- Parameters:
action- the action to perform for each entry
-
keySet
Get the set of all keys in this map.- Returns:
- the set of keys in this map.
-
values
Get the values of all entries in this map.- Returns:
- the set of values in the map.
-
results
Get the unwrapped results of all entries in this map with a non-exception result.- Returns:
- the set of all results in the map.
-
exceptions
Get the unwrapped exceptions of all entries in this map with an exceptional result.- Returns:
- the set of all exceptions in the map.
-
size
public int size()- Returns:
- the size of this map.
-
isEmpty
public boolean isEmpty()Determine whether this map is empty.- Returns:
tureif this map is empty,falseotherwise.
-