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