T
- item-type in the storepublic class EagerEvaluationStore<T> extends Object implements NamedProviderStore<T>
StoreSupplier
as soon as they are added.Constructor and Description |
---|
EagerEvaluationStore() |
Modifier and Type | Method and Description |
---|---|
void |
add(String identifier,
StoreSupplier<T> supplier)
Adds an element to the store.
|
Optional<T> |
getOptional(String key)
Retrieves the item if it exists, or returns
Optional.empty() if it doesn't exist. |
Set<String> |
keys()
Returns a set of keys associated with the provider.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getArbitraryElement, getException, isEmpty
public Set<String> keys()
NamedProvider
There's no guarantee that it refers to all valid keys.
keys
in interface NamedProvider<T>
public void add(String identifier, StoreSupplier<T> supplier) throws OperationFailedException
NamedProviderStore
add
in interface NamedProviderStore<T>
identifier
- a unique identifier for the element.supplier
- supplies the element to be added (which may be evaluated immediately, or a
later point lazily).OperationFailedException
- if the identifier already exists, or otherwise the add
operation fails.public Optional<T> getOptional(String key)
NamedProvider
Optional.empty()
if it doesn't exist.
Note that a 'key' might still throw an exception for another reason (but never because a particular key is absent).
getOptional
in interface NamedProvider<T>
key
- a unique name for the item.Optional.empty()
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.