Package org.hipparchus.util
Class OpenIntToFieldHashMap<T extends FieldElement<T>>
java.lang.Object
org.hipparchus.util.AbstractOpenIntHashMap
org.hipparchus.util.OpenIntToFieldHashMap<T>
- Type Parameters:
T- the type of the field elements
- All Implemented Interfaces:
Serializable
public class OpenIntToFieldHashMap<T extends FieldElement<T>>
extends AbstractOpenIntHashMap
implements Serializable
Open addressed map from int to FieldElement.
This class provides a dedicated map from integers to FieldElements with a
much smaller memory overhead than standard java.util.Map.
This class is not synchronized. The specialized iterators returned by
iterator() are fail-fast: they throw a
ConcurrentModificationException when they detect the map has been
modified during iteration.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassIterator class for the map.Nested classes/interfaces inherited from class org.hipparchus.util.AbstractOpenIntHashMap
AbstractOpenIntHashMap.BaseIterator, AbstractOpenIntHashMap.InsertionHolder, AbstractOpenIntHashMap.ValueCopier -
Field Summary
Fields inherited from class org.hipparchus.util.AbstractOpenIntHashMap
DEFAULT_EXPECTED_SIZE, RESIZE_MULTIPLIER -
Constructor Summary
ConstructorsConstructorDescriptionOpenIntToFieldHashMap(Field<T> field) Build an empty map with default size and using zero for missing entries.OpenIntToFieldHashMap(Field<T> field, int expectedSize) Build an empty map with specified size and using zero for missing entries.OpenIntToFieldHashMap(Field<T> field, int expectedSize, T missingEntries) Build an empty map with specified size.OpenIntToFieldHashMap(Field<T> field, T missingEntries) Build an empty map with default sizeOpenIntToFieldHashMap(OpenIntToFieldHashMap<T> source) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(int key) Get the stored value associated with the given keyprotected intgrowTable(int oldIndex) Grow the tables.inthashCode()iterator()Get an iterator over map elements.Put a value associated with a key in the map.remove(int key) Remove the value associated with a key.Methods inherited from class org.hipparchus.util.AbstractOpenIntHashMap
containsKey, containsKey, doGrowTable, doRemove, equalKeys, equalStates, getCapacity, getSize, keysStatesHashCode, locate, put, resetCount, size
-
Constructor Details
-
OpenIntToFieldHashMap
Build an empty map with default size and using zero for missing entries.- Parameters:
field- field to which the elements belong
-
OpenIntToFieldHashMap
Build an empty map with default size- Parameters:
field- field to which the elements belongmissingEntries- value to return when a missing entry is fetched
-
OpenIntToFieldHashMap
Build an empty map with specified size and using zero for missing entries.- Parameters:
field- field to which the elements belongexpectedSize- expected number of elements in the map
-
OpenIntToFieldHashMap
Build an empty map with specified size.- Parameters:
field- field to which the elements belongexpectedSize- expected number of elements in the mapmissingEntries- value to return when a missing entry is fetched
-
OpenIntToFieldHashMap
Copy constructor.- Parameters:
source- map to copy
-
-
Method Details
-
get
Get the stored value associated with the given key- Parameters:
key- key associated with the data- Returns:
- data associated with the key
-
iterator
Get an iterator over map elements.The specialized iterators returned are fail-fast: they throw a
ConcurrentModificationExceptionwhen they detect the map has been modified during iteration.- Returns:
- iterator over the map elements
-
equals
-
hashCode
public int hashCode() -
remove
Remove the value associated with a key.- Parameters:
key- key to which the value is associated- Returns:
- removed value
-
put
Put a value associated with a key in the map.- Parameters:
key- key to which value is associatedvalue- value to put in the map- Returns:
- previous value associated with the key
-
growTable
protected int growTable(int oldIndex) Grow the tables.- Specified by:
growTablein classAbstractOpenIntHashMap- Parameters:
oldIndex- index the entry being inserted should have used- Returns:
- index the entry being inserted should really use
-