K
- The key type of the map, compared by reference (==
).V
- The value type of the map.@ApiStatus.NonExtendable
public interface ApiProviderMap<K,V>
ApiLookupMap
for a usage example.
Note: This map allows very fast lock-free concurrent reads, but in exchange writes are very expensive and should not be too frequent.
Also, keys are compared by reference (==
) and not using Object.equals(java.lang.Object)
.
Modifier and Type | Method and Description |
---|---|
static <K,V> ApiProviderMap<K,V> |
create()
Create a new instance.
|
V |
get(K key)
Return the provider to which the specified key is mapped,
or
null if this map contains no mapping for the key. |
V |
putIfAbsent(K key,
V provider)
If the specified key is not already associated with a provider,
associate it with the given value and return
null , else return the current value. |
static <K,V> ApiProviderMap<K,V> create()
@Nullable V get(K key)
null
if this map contains no mapping for the key.NullPointerException
- If the key is null.V putIfAbsent(K key, V provider)
null
, else return the current value.NullPointerException
- If the key or the provider is null.