ch.bind.philib.util
Class StaticLongMap<T>
java.lang.Object
ch.bind.philib.util.StaticLongMap<T>
public final class StaticLongMap<T>
- extends Object
A statically initialized and immutable map of long -> T.
- Author:
- Philipp Meinen
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
create
public static <T> StaticLongMap<T> create(Collection<? extends LongPair<T>> elements)
- Parameters:
elements -
- Returns:
- A fully initialized
StaticLongMap.
- Throws:
IllegalArgumentException - If the elements parameter is null, empty or contains
duplicate keys.
NullPointerException - If any value in elements is a null-value.
create
public static <T> StaticLongMap<T> create(LongPair<T>[] elements)
- Parameters:
elements -
- Returns:
- A fully initialized
StaticLongMap.
- Throws:
IllegalArgumentException - If the elements parameter is null, empty or contains
duplicate keys.
NullPointerException - If any value in elements is a null-value.
get
public T get(long key)
- Parameters:
key -
- Returns:
- The value associated with
key, which may be null.
getOrElse
public T getOrElse(long key,
T defaultVal)
- Parameters:
key -
- Returns:
- The value associated with
key, defaultVal otherwise.
getOrThrow
public T getOrThrow(long key)
throws NoSuchElementException
- Parameters:
key -
- Returns:
- The value associated with
key, which may be null.
- Throws:
NoSuchElementException - If no value is associated with key.
containsKey
public boolean containsKey(long key)
size
public int size()
Copyright © 2013. All Rights Reserved.