Package io.micronaut.core.value
Interface OptionalValues<V>
- Type Parameters:
- V- The generic value
- All Superinterfaces:
- Iterable<CharSequence>
- All Known Subinterfaces:
- OptionalMultiValues<V>
- All Known Implementing Classes:
- OptionalValuesMap
A simple type safe abstraction over a map of optional values.
- Since:
- 1.0
- Author:
- Graeme Rocher
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> OptionalValues<T>empty()An emptyOptionalValues.default voidforEach(BiConsumer<CharSequence, ? super V> action) Performs the given action for each entry in thisOptionalValuesuntil all entries have been processed or the action throws an exception.get(CharSequence name) Retrieve a value if it is present.default booleanisEmpty()static <T> OptionalValues<T>of(Class<T> type, @Nullable Map<CharSequence, ?> values) Creates a newOptionalValuesfor the given type and values.values()Methods inherited from interface java.lang.IterableforEach, iterator, spliterator
- 
Field Details- 
EMPTY_VALUESConstant for empty values.
 
- 
- 
Method Details- 
getRetrieve a value if it is present.- Parameters:
- name- The name of the value
- Returns:
- An Optionalof the value
 
- 
valuesCollection<V> values()- Returns:
- The values
 
- 
isEmptydefault boolean isEmpty()- Returns:
- Whether the OptionalValuesis empty
 
- 
forEachPerforms the given action for each entry in thisOptionalValuesuntil all entries have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.) Exceptions thrown by the action are relayed to the caller.- Parameters:
- action- The action to be performed for each entry
- Throws:
- NullPointerException- if the specified action is null removed during iteration
 
- 
emptyAn emptyOptionalValues.- Type Parameters:
- T- The generic type
- Returns:
- The empty values
 
- 
ofCreates a newOptionalValuesfor the given type and values.- Type Parameters:
- T- The target generic type
- Parameters:
- type- The target type
- values- A map of values
- Returns:
- The values
 
 
-