public interface XIntMap<V>
An XIntMap serves as an alternative to Map that can be used
to avoid garbage associated with autoboxing of key values.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
XIntMap.Entry<V>
A Map Entry with a primitive int key.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all map's entries.
|
boolean |
containsKey(int key) |
boolean |
containsValue(Object value) |
Set<XIntMap.Entry<V>> |
entrySet()
Returns a
Set view of the mappings contained in this
map. |
boolean |
equals(Object o) |
V |
get(int key)
Returns the value to which this map associates the specified key.
|
int |
hashCode() |
boolean |
isEmpty() |
XIntSet |
keySet()
Returns a
XIntSet view of the keys contained in this
map. |
V |
put(int key,
V value)
Associates the specified value with the specified key in this map.
|
void |
putAll(XIntMap<? extends V> map)
Copies all of the mappings from the specified map to this map.
|
V |
remove(int key)
Removes the entry for the specified key if present.
|
XIterator<XIntMap.Entry<V>> |
reuseableEntryIterator()
Returns a reusable value iterator.
|
XIntIterator |
reuseableKeyIterator()
Returns a reusable key iterator.
|
XIterator<V> |
reuseableValueIterator()
Returns a reusable value iterator.
|
int |
size() |
Collection<V> |
values()
Returns a
Collection view of the values contained in this
map. |
int size()
Map.size()boolean isEmpty()
Map.isEmpty()boolean containsKey(int key)
Map.containsKey(Object)boolean containsValue(Object value)
Map.containsValue(Object)V get(int key)
key - the key whose associated value is to be returned.null if there is no mapping for the key.Map.get(Object)V put(int key, V value)
key - the key with which the specified value is to be associated.value - the value to be associated with the specified key.null if there was no mapping for key. A
null return can also indicate that the map
previously associated null with the specified key.Map.put(Object, Object)V remove(int key)
Note: Shared maps in ImmortalMemory (e.g. static) should not remove
their entries as it could cause a memory leak (ImmortalMemory
is never garbage collected), instead they should set their
entry values to null.
key - the key whose mapping is to be removed from the map.null if there was no mapping for key. A
null return can also indicate that the map
previously associated null with the specified key.void putAll(XIntMap<? extends V> map)
map - the mappings to be stored in this map.NullPointerException - the specified map is null,
or the specified map contains null keys.void clear()
XIntSet keySet()
XIntSet view of the keys contained in this
map.
The collection is backed by the map, so changes to the
map are reflected in the collection, and vice-versa. The collection
supports element removal, which removes the corresponding mapping from
this map, via the Iterator.remove,
Collection.remove, removeAll,
retainAll and clear operations.
It does not support the add or addAll
operations.
XIntIterator reuseableKeyIterator()
XIterator.toFirst() is called by this method to reset it
to the beginning.UnsupportedOperationException - if the map doesn't support reusable iterators.XIterator<V> reuseableValueIterator()
XIterator.toFirst() is called by this method to reset it
to the beginning.UnsupportedOperationException - if the map doesn't support reusable iterators.XIterator<XIntMap.Entry<V>> reuseableEntryIterator()
XIterator.toFirst() is called by this method to reset it
to the beginning.UnsupportedOperationException - if the map doesn't support reusable iterators.Collection<V> values()
Collection view of the values contained in this
map.
The collection is backed by the map, so changes to the
map are reflected in the collection, and vice-versa. The collection
supports element removal, which removes the corresponding mapping from
this map, via the Iterator.remove,
Collection.remove, removeAll,
retainAll and clear operations.
It does not support the add or addAll
operations.
Set<XIntMap.Entry<V>> entrySet()
Set view of the mappings contained in this
map.
Each element in the returned set is a
XIntMap.Entry. The set is backed by the map, so
changes to the map are reflected in the set, and vice-versa. The
set supports element removal, which removes the corresponding
mapping from this map, via the Iterator.remove,
Set.remove,removeAll,
retainAll, and clear operations. It does
not support the add or addAll operations.
Copyright © 2019 Neeve Research, LLC. All Rights Reserved.