Class KeyValueProvider<K,V>

java.lang.Object
org.hibernate.search.util.common.data.spi.KeyValueProvider<K,V>
Type Parameters:
K - The type of keys.
V - The type of values.

public final class KeyValueProvider<K,V> extends Object
A simpler, safer, read-only wrapper around Map that exposes only a few methods to retrieve a value from a given key.

Methods either makes it clear there might be no value (through the method name or Optional return type) or are guaranteed to throw an exception when no value can be found, with a meaningful message (including a list of all available keys).

This class only makes sense where there is a relatively low number of keys, as exception messages will include a list of all available keys.