Interface EntryView.ReadEntryView<K,V>
- All Superinterfaces:
MetaParam.Lookup
- All Known Subinterfaces:
EntryView.ReadWriteEntryView<K,
,V> EntryViews.AccessLoggingReadWriteView<K,
V>
- Enclosing class:
- EntryView
MetaParam
information.
It exposes both get()
and find()
methods for
convenience. If the caller knows for sure that the value will be
present, get()
offers the convenience of retrieving the value
directly without having to get an Optional
first. As a result
of this, get()
throws NoSuchElementException
if
there's no value associated with the entry. If the caller is unsure
of whether the value is present, find()
should be used.
This approach avoids the user having to do null checks.
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptionfind()
Optional value.get()
Returns a non-null value if the key has a value associated with it or throwsNoSuchElementException
if no value is associated with the entry.key()
Key of the read-only entry view.peek()
The same asfind()
but does not update any hit/miss statistics.Methods inherited from interface org.infinispan.functional.MetaParam.Lookup
findMetaParam
-
Method Details
-
key
K key()Key of the read-only entry view. Guaranteed to return a non-null value. The instance of the key must not be mutated. -
get
Returns a non-null value if the key has a value associated with it or throwsNoSuchElementException
if no value is associated with the entry.The value instance is read-only and must not be mutated. If the function accessing this value is about to update the entry, it has to create a defensive copy (or completely new instance) and store it using
EntryView.WriteEntryView.set(Object, MetaParam.Writable[])
.- Throws:
NoSuchElementException
- if no value is associated with the key.
-
find
Optional value. It'll return a non-empty value when the value is present, and empty when the value is not present.The value instance is read-only and must not be mutated. If the function accessing this value is about to update the entry, it has to create a defensive copy (or completely new instance) and store it using
EntryView.WriteEntryView.set(Object, MetaParam.Writable[])
. -
peek
The same asfind()
but does not update any hit/miss statistics.- Returns:
-