public interface XLongMap<V>
An XLongMap 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 |
XLongMap.Entry<V>
A Map Entry with a primitive long key.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all map's entries.
|
boolean |
containsKey(long key) |
boolean |
containsValue(Object value) |
Set<XLongMap.Entry<V>> |
entrySet()
Returns a
Set view of the mappings contained in this
map. |
boolean |
equals(Object o) |
V |
get(long key)
Returns the value to which this map associates the specified key.
|
int |
hashCode() |
boolean |
isEmpty() |
XLongSet |
keySet()
Returns a
XLongSet view of the keys contained in this
map. |
V |
put(long key,
V value)
Associates the specified value with the specified key in this map.
|
void |
putAll(XLongMap<? extends V> map)
Copies all of the mappings from the specified map to this map.
|
V |
remove(long key)
Removes the entry for the specified key if present.
|
XIterator<XLongMap.Entry<V>> |
reuseableEntryIterator()
Returns a reusable value iterator.
|
XLongIterator |
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(long key)
Map.containsKey(Object)
boolean containsValue(Object value)
Map.containsValue(Object)
V get(long 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(long 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(long 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(XLongMap<? 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()
XLongSet keySet()
XLongSet
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.
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<XLongMap.Entry<V>> entrySet()
Set
view of the mappings contained in this
map.
Each element in the returned set is a
XLongMap.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.
XLongIterator 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<XLongMap.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.Copyright © 2019 Neeve Research, LLC. All Rights Reserved.