@Stability.Internal public interface IntMap<E>
Modifier and Type | Method and Description |
---|---|
static <E extends Enum<?>> |
from(Class<E> enumClass,
Function<E,Integer> keyExtractor)
Returns a new instance where the values are the values of the given enum class,
and the associated key is derived by applying the given function to the value.
|
static <E> IntMap<E> |
from(Iterable<E> items,
Function<E,Integer> keyExtractor)
Returns a new instance where the values are the values of the given iterable,
and the associated key is derived by applying the given function to the value.
|
static <E> IntMap<E> |
from(Map<Integer,E> map)
Returns a new instance from the entries of the given map.
|
default E |
get(byte key)
Reinterprets the byte as a positive integer, then returns the value
associated with the given integer, or null if not found.
|
E |
get(int key)
Returns the value associated with the given integer, or null if not found.
|
default E |
get(short key)
Reinterprets the short as a positive integer, then returns the value
associated with the given integer, or null if not found.
|
@Nullable E get(int key)
key
- the non-negative integer associated with the value to returnIllegalArgumentException
- if the given key is negative.@Nullable default E get(short key)
key
- the short associated with the value to return@Nullable default E get(byte key)
key
- the byte associated with the value to returnstatic <E extends Enum<?>> IntMap<E> from(Class<E> enumClass, Function<E,Integer> keyExtractor)
IllegalArgumentException
- if a derived key is negative, null, or not uniquestatic <E> IntMap<E> from(Iterable<E> items, Function<E,Integer> keyExtractor)
IllegalArgumentException
- if a derived key is negative, null, or not uniquestatic <E> IntMap<E> from(Map<Integer,E> map)
IllegalArgumentException
- if the map contains a key that is null or negative.Copyright © 2024 Couchbase, Inc.. All rights reserved.