public class IntHashMap<T>
extends java.lang.Object
Constructor and Description |
---|
IntHashMap()
Initializes a map with a capacity of 8 and a load factor of 0,25.
|
IntHashMap(int capacity)
Initializes a map with the given capacity and a load factor of 0,25.
|
IntHashMap(int capacity,
double factor)
Constructs a new map with initial capacity, and load factor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the map.
|
IntHashMap<T> |
copy()
Create a copy of the IntHashMap
|
void |
display(java.io.PrintStream ps)
Diagnostic display of contents
|
T |
get(int key)
Gets the value for this key.
|
IntIterator |
keyIterator()
Get an iterator over the keys
|
IntSet |
keySet()
Get the set of integer keys present in this IntHashSet
|
T |
put(int key,
T value)
Adds a key-value pair to the map.
|
boolean |
remove(int key)
Removes a key from the map.
|
int |
size()
Gets the size of the map.
|
java.util.Iterator<T> |
valueIterator()
Get an iterator over the values
|
java.lang.Iterable<T> |
valueSet()
Get the set of values
|
public IntHashMap()
public IntHashMap(int capacity)
capacity
- the initial capacity.public IntHashMap(int capacity, double factor)
The capacity is the number of keys that can be mapped without resizing the arrays in which keys and values are stored. For efficiency, only a fraction of the elements in those arrays are used. That fraction is the specified load factor. The initial length of the arrays equals the smallest power of two not less than the ratio capacity/factor. The capacity of the map is increased, as necessary. The maximum number of keys that can be mapped is 2^30.
capacity
- the initial capacity.factor
- the load factor.public void clear()
public T get(int key)
key
- Keypublic int size()
public boolean remove(int key)
key
- Key to removepublic T put(int key, T value)
key
- Keyvalue
- Valuepublic IntIterator keyIterator()
public java.util.Iterator<T> valueIterator()
public java.lang.Iterable<T> valueSet()
public IntHashMap<T> copy()
public void display(java.io.PrintStream ps)
public IntSet keySet()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.