public class MapFromObject extends UntypedMap
An untyped map, intended for internal use by strongly-typed maps which inherit from the MapBase
class.
Constructor and Description |
---|
MapFromObject(int capacity)
Construct a new map with
MapFromObject.size of zero and specified initial capacity . |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all entries from this map.
|
void |
copyKeysTo(UntypedList list)
Copy the keys in this map to the
list argument. |
void |
copyValuesTo(UntypedList list)
Copy the values in this map to the
list argument. |
boolean |
delete(java.lang.Object key)
Delete the entry with the specified
key (if found). |
java.lang.Object |
get(java.lang.Object key)
Return (nullable) The entry with the specified
key (if found), otherwise null . |
java.lang.Object |
getRequired(java.lang.Object key)
Return the entry with the specified
key (if found). |
boolean |
has(java.lang.Object key)
Return
true if this map has an entry with the specified key , otherwise false . |
boolean |
isEmpty()
true if this map contains no entries. |
boolean |
isMutable()
true if this map is mutable. |
MapIteratorFromObject |
iteratorFromObject()
For internal use only.
|
UntypedList |
keys()
Return a list of the entry keys in this map.
|
void |
set(java.lang.Object key,
java.lang.Object value)
Add or replace an entry with the specified
key and value . |
int |
size()
The number of entries in this map.
|
java.lang.String |
toString()
Return a string representation of this map.
|
UntypedList |
values()
Return a list of the entry values in this map.
|
public MapFromObject(int capacity)
Construct a new map with MapFromObject.size
of zero and specified initial capacity
.
A map can expand in size beyond its initial capacity, but best performance
will be obtained if the initial capacity is close to the map's maximum size.
capacity
- Initial capacity.public void clear()
Remove all entries from this map.
clear
in class UntypedMap
public void copyKeysTo(UntypedList list)
Copy the keys in this map to the list
argument.
copyKeysTo
in class UntypedMap
list
- List to receive copied keys.public void copyValuesTo(UntypedList list)
Copy the values in this map to the list
argument.
copyValuesTo
in class UntypedMap
list
- List to receive copied values.public boolean delete(java.lang.Object key)
Delete the entry with the specified key
(if found).
delete
in class UntypedMap
key
- (nullable) Entry key.true
if an entry with the specified key
was found (and deleted).public java.lang.Object get(java.lang.Object key)
Return (nullable) The entry with the specified key
(if found), otherwise null
.
get
in class UntypedMap
key
- (nullable) Entry key.key
(if found), otherwise null
.public java.lang.Object getRequired(java.lang.Object key)
Return the entry with the specified key
(if found).
MissingEntryException
if no entry is found for the specified key.
getRequired
in class UntypedMap
key
- (nullable) Entry key.public boolean has(java.lang.Object key)
Return true
if this map has an entry with the specified key
, otherwise false
.
has
in class UntypedMap
key
- (nullable) Entry key.true
if this map has an entry with the specified key
, otherwise false
.public boolean isEmpty()
true
if this map contains no entries.
isEmpty
in class UntypedMap
public boolean isMutable()
true
if this map is mutable.
isMutable
in class UntypedMap
public MapIteratorFromObject iteratorFromObject()
For internal use only.
public UntypedList keys()
Return a list of the entry keys in this map.
keys
in class UntypedMap
public void set(java.lang.Object key, java.lang.Object value)
Add or replace an entry with the specified key
and value
.
set
in class UntypedMap
key
- (nullable) Entry key.value
- (nullable) Entry value.public int size()
The number of entries in this map.
size
in class UntypedMap
public java.lang.String toString()
Return a string representation of this map.
toString
in class UntypedMap
public UntypedList values()
Return a list of the entry values in this map.
values
in class UntypedMap