public class ShortMap<V> extends java.lang.Object implements java.lang.Iterable<ShortMap.Entry<V>>
Modifier and Type | Class and Description |
---|---|
static class |
ShortMap.Entries<V> |
static class |
ShortMap.Entry<V> |
static class |
ShortMap.Keys |
static class |
ShortMap.Values<V> |
Modifier and Type | Field and Description |
---|---|
int |
size |
Constructor and Description |
---|
ShortMap()
Creates a new map with an initial capacity of 51 and a load factor of 0.8.
|
ShortMap(int initialCapacity)
Creates a new map with a load factor of 0.8.
|
ShortMap(int initialCapacity,
float loadFactor)
Creates a new map with the specified initial capacity and load factor.
|
ShortMap(ShortMap<? extends V> map)
Creates a new map identical to the specified map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
clear(int maximumCapacity)
Clears the map and reduces the size of the backing arrays to be the specified capacity if they are larger.
|
boolean |
containsKey(short key) |
boolean |
containsValue(java.lang.Object value,
boolean identity)
Returns true if the specified value is in the map.
|
void |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
ShortMap.Entries<V> |
entries()
Returns an iterator for the entries in the map.
|
boolean |
equals(java.lang.Object obj) |
short |
findKey(java.lang.Object value,
boolean identity,
short notFound)
Returns the key for the specified value, or notFound if it is not in the map.
|
V |
get(short key) |
V |
get(short key,
V defaultValue) |
int |
hashCode() |
java.util.Iterator<ShortMap.Entry<V>> |
iterator() |
ShortMap.Keys |
keys()
Returns an iterator for the keys in the map.
|
V |
put(short key,
V value) |
void |
putAll(ShortMap<V> map) |
V |
remove(short key) |
void |
shrink(int maximumCapacity)
Reduces the size of the backing arrays to be the specified capacity or less.
|
java.lang.String |
toString() |
ShortMap.Values<V> |
values()
Returns an iterator for the values in the map.
|
public ShortMap()
public ShortMap(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public ShortMap(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public V get(short key)
public V remove(short key)
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
public boolean containsValue(java.lang.Object value, boolean identity)
public boolean containsKey(short key)
public short findKey(java.lang.Object value, boolean identity, short notFound)
identity
- If true, uses == to compare the specified value with values in the map. If false, uses
equals(Object)
.public void ensureCapacity(int additionalCapacity)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Iterator<ShortMap.Entry<V>> iterator()
iterator
in interface java.lang.Iterable<ShortMap.Entry<V>>
public ShortMap.Entries<V> entries()
ShortMap.Entries
constructor for nested or multithreaded iteration.public ShortMap.Values<V> values()
ShortMap.Entries
constructor for nested or multithreaded iteration.public ShortMap.Keys keys()
ShortMap.Entries
constructor for nested or multithreaded iteration.