Cloneable, Sequenceablepublic class PacMap extends BasePacMap
Map objects that support Sequenceable operations and can be used to store and read key-value
pairs in character string format.Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static PacMap |
EMPTY_PAC_MAP |
A static variable indicating an empty
PacMap object. |
static Sequenceable.Producer<PacMap> |
PRODUCER |
Indicates a static public member used to create a
PacMap instance. |
dataMap| 构造器 | 说明 |
|---|---|
PacMap() |
Default constructor used to create a
PacMap instance, in which the Map object has no key-value
pair. |
PacMap(int capacity) |
A constructor used to create a
PacMap instance with the number of key-value pairs specified by
Map. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
clear() |
Clears the current object.
|
Object |
clone() |
Creates and returns a copy of this object.
|
PacMap |
deepCopy() |
Creates a deep copy of this
PacMap object. |
boolean |
equals(Object object) |
Indicates whether some other object is "equal to" this one.
|
Map<String,Object> |
getAll() |
Obtains all the data that has been stored.
|
boolean |
getBooleanValue(String key) |
Obtains the
boolean value matching a specified key. |
boolean |
getBooleanValue(String key,
boolean defaultValue) |
Obtains the
boolean value matching a specified key. |
boolean[] |
getBooleanValueArray(String key) |
Obtains the
boolean[] value matching a specified key. |
byte |
getByteValue(String key) |
Obtains the
byte value matching a specified key. |
byte |
getByteValue(String key,
byte defaultValue) |
Obtains the
byte value matching a specified key. |
byte[] |
getByteValueArray(String key) |
Obtains the
byte[] value matching a specified key. |
char |
getChar(String key) |
Obtains the
char value matching a specified key. |
char |
getChar(String key,
char defaultValue) |
Obtains the
char value matching a specified key. |
char[] |
getCharArray(String key) |
Obtains the
char[] value matching a specified key. |
double |
getDoubleValue(String key) |
Obtains the
double value matching a specified key. |
double |
getDoubleValue(String key,
double defaultValue) |
Obtains the
double value matching a specified key. |
double[] |
getDoubleValueArray(String key) |
Obtains the
double[] value matching a specified key. |
float |
getFloatValue(String key) |
Obtains the
float value matching a specified key. |
float |
getFloatValue(String key,
float defaultValue) |
Obtains the
float value matching a specified key. |
float[] |
getFloatValueArray(String key) |
Obtains the
float[] value matching a specified key. |
ArrayList<Integer> |
getIntegerList(String key) |
Obtains the
ArrayList<Integer> value matching a specified key. |
int |
getIntValue(String key) |
Obtains the
int value matching a specified key. |
int |
getIntValue(String key,
int defaultValue) |
Obtains the
int value matching a specified key. |
int[] |
getIntValueArray(String key) |
Obtains the
int[] value matching a specified key. |
Set<String> |
getKeys() |
Obtains all the keys of the current object.
|
long |
getLongValue(String key) |
Obtains the
long value matching a specified key. |
long |
getLongValue(String key,
long defaultValue) |
Obtains the
long value matching a specified key. |
long[] |
getLongValueArray(String key) |
Obtains the
long[] value matching a specified key. |
Optional<Object> |
getObjectValue(String key) |
Obtains an object with a specified key.
|
Optional<PacMap> |
getPacMap(String key) |
Obtains the
PacMap value matching a specified key. |
Optional<Sequenceable> |
getSequenceable(String key) |
Obtains the
Sequenceable value matching a specified key. |
Sequenceable[] |
getSequenceableArray(String key) |
Obtains the
Sequenceable[] value matching a specified key. |
ArrayList<Sequenceable> |
getSequenceableList(String key) |
Obtains the
ArrayList<Sequenceable> value matching a specified key. |
Optional<Serializable> |
getSerializable(String key) |
Obtains the
Serializable value matching a specified key. |
short |
getShortValue(String key) |
Obtains the
short value matching a specified key. |
short |
getShortValue(String key,
short defaultValue) |
Obtains the
short value matching a specified key. |
short[] |
getShortValueArray(String key) |
Obtains the
short[] value matching a specified key. |
int |
getSize() |
Obtains the number of key-value pairs stored in the current object.
|
String |
getString(String key) |
Obtains the
String value matching a specified key. |
String |
getString(String key,
String defaultValue) |
Obtains the
String value matching a specified key. |
String[] |
getStringArray(String key) |
Obtains the
String[] value matching a specified key. |
ArrayList<String> |
getStringList(String key) |
Obtains the
ArrayList<String> value matching a specified key. |
int |
hashCode() |
Returns a hash code value for the object.
|
boolean |
hasKey(String key) |
Checks whether a specified key is contained.
|
boolean |
isEmpty() |
Checks whether the current object is empty.
|
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
void |
putAll(Map<String,Object> map) |
Inserts all key-value pairs of a
Map object into the built-in data object. |
void |
putAll(PacMap map) |
Saves the data in a
PacMap object to the current object. |
void |
putBooleanValue(String key,
boolean value) |
Adds a
boolean value matching a specified key. |
void |
putBooleanValueArray(String key,
boolean[] value) |
Adds a
boolean[] value matching a specified key. |
void |
putByteValue(String key,
byte value) |
Adds a
byte value matching a specified key. |
void |
putByteValueArray(String key,
byte[] value) |
Adds a
byte[] value matching a specified key. |
void |
putChar(String key,
char value) |
Adds a
char value matching a specified key. |
void |
putCharArray(String key,
char[] value) |
Adds a
char[] value matching a specified key. |
void |
putDoubleValue(String key,
double value) |
Adds a
double value matching a specified key. |
void |
putDoubleValueArray(String key,
double[] value) |
Adds a
double[] value matching a specified key. |
void |
putFloatValue(String key,
float value) |
Adds a
float value matching a specified key. |
void |
putFloatValueArray(String key,
float[] value) |
Adds a
float[] value matching a specified key. |
void |
putIntegerList(String key,
ArrayList<Integer> value) |
Adds an
ArrayList<Integer> value matching a specified key. |
void |
putIntValue(String key,
int value) |
Adds an
int value matching a specified key. |
void |
putIntValueArray(String key,
int[] value) |
Adds an
int[] value matching a specified key. |
void |
putLongValue(String key,
long value) |
Adds a
long value matching a specified key. |
void |
putLongValueArray(String key,
long[] value) |
Adds a
long[] value matching a specified key. |
void |
putObjectValue(String key,
Object value) |
Adds a universal object with a specified key.
|
void |
putPacMap(String key,
PacMap pacMap) |
Adds a
PacMap value matching a specified key. |
void |
putSequenceableObject(String key,
Sequenceable sequenceable) |
Adds a
Sequenceable value matching a specified key. |
void |
putSequenceableObjectArray(String key,
Sequenceable[] sequenceables) |
Adds a
Sequenceable[] value matching a specified key. |
void |
putSequenceableObjectList(String key,
ArrayList<Sequenceable> sequenceables) |
Adds an
ArrayList<Sequenceable> value matching a specified key. |
void |
putSerializableObject(String key,
Serializable serializable) |
Adds a
Serializable value matching a specified key. |
void |
putShortValue(String key,
short value) |
Adds a
short value matching a specified key. |
void |
putShortValueArray(String key,
short[] value) |
Adds a
short[] value matching a specified key. |
void |
putString(String key,
String value) |
Adds a
String value matching a specified key. |
void |
putStringArray(String key,
String[] value) |
Adds a
String[] value matching a specified key. |
void |
putStringList(String key,
ArrayList<String> strings) |
Adds an
ArrayList<String> value matching a specified key. |
void |
remove(String key) |
Deletes a key-value pair with a specified key.
|
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
public static final PacMap EMPTY_PAC_MAP
PacMap object.public static final Sequenceable.Producer<PacMap> PRODUCER
PacMap instance.public PacMap(int capacity)
PacMap instance with the number of key-value pairs specified by
Map.capacity - Indicates the number of key-value pairs specified by Map.public PacMap()
PacMap instance, in which the Map object has no key-value
pair.public void putAll(Map<String,Object> map)
Map object into the built-in data object.putAll 在类中 BasePacMapmap - Indicates the Map object whose keys are strings.public void putAll(PacMap map)
PacMap object to the current object.map - Indicates the PacMap object whose data is to be saved.public Map<String,Object> getAll()
getAll 在类中 BasePacMapMap object containing keys in string format.public void putObjectValue(String key, Object value)
putObjectValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the object to be added.public void putByteValue(String key, byte value)
byte value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putByteValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the byte value to be added.public void putShortValue(String key, short value)
short value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putShortValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the short value to be added.public void putIntValue(String key, int value)
int value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putIntValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the int value to be added.public void putLongValue(String key, long value)
long value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putLongValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the long value to be added.public void putFloatValue(String key, float value)
float value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putFloatValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the float value to be added.public void putDoubleValue(String key, double value)
double value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putDoubleValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the double value to be added.public void putBooleanValue(String key, boolean value)
boolean value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putBooleanValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the boolean value to be added.public void putChar(String key, char value)
char value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putChar 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the char value to be added.public void putString(String key, String value)
String value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putString 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the String value to be added.public void putByteValueArray(String key, byte[] value)
byte[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putByteValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the byte[] value to be added.public void putShortValueArray(String key, short[] value)
short[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putShortValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the short[] value to be added.public void putIntValueArray(String key, int[] value)
int[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putIntValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the int[] value to be added.public void putIntegerList(String key, ArrayList<Integer> value)
ArrayList<Integer> value matching a specified key. If a value matching the key already exists, it
will be replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the ArrayList<Integer> value to be added.public void putLongValueArray(String key, long[] value)
long[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putLongValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the long[] value to be added.public void putFloatValueArray(String key, float[] value)
float[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putFloatValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the float[] value to be added.public void putDoubleValueArray(String key, double[] value)
double[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putDoubleValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the double[] value to be added.public void putBooleanValueArray(String key, boolean[] value)
boolean[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putBooleanValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the boolean[] value to be added.public void putCharArray(String key, char[] value)
char[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putCharArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the char[] value to be added.public void putStringArray(String key, String[] value)
String[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.putStringArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.value - Indicates the String[] value to be added.public void putStringList(String key, ArrayList<String> strings)
ArrayList<String> value matching a specified key. If a value matching the key already exists, it
will be replaced by the added value.key - Indicates the key in String format, which can be null.strings - Indicates the ArrayList<String> value to be added.public void putPacMap(String key, PacMap pacMap)
PacMap value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.pacMap - Indicates the PacMap value to be added.public void putSerializableObject(String key, Serializable serializable)
Serializable value matching a specified key. If a value matching the key already exists, it will
be replaced by the added value.key - Indicates the key in String format, which can be null.serializable - Indicates the Serializable value to be added.public void putSequenceableObject(String key, Sequenceable sequenceable)
Sequenceable value matching a specified key. If a value matching the key already exists, it will
be
replaced by the added value.key - Indicates the key in String format, which can be null.sequenceable - Indicates the Sequenceable value to be added.public void putSequenceableObjectArray(String key, Sequenceable[] sequenceables)
Sequenceable[] value matching a specified key. If a value matching the key already exists, it will
be replaced by the added value.key - Indicates the key in String format, which can be null.sequenceables - Indicates the Sequenceable[] value to be added.public void putSequenceableObjectList(String key, ArrayList<Sequenceable> sequenceables)
ArrayList<Sequenceable> value matching a specified key. If a value matching the key already
exists,
it will be replaced by the added value.key - Indicates the key in String format, which can be null.sequenceables - Indicates the ArrayList<Sequenceable> value to be added.public Optional<Object> getObjectValue(String key)
getObjectValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.Optional; returns
null if no such object is found.public byte getByteValue(String key, byte defaultValue)
byte value matching a specified key.getByteValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.byte value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public byte getByteValue(String key)
byte value matching a specified key.getByteValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.byte value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public short getShortValue(String key, short defaultValue)
short value matching a specified key.getShortValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.short value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public short getShortValue(String key)
short value matching a specified key.getShortValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.short value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public int getIntValue(String key, int defaultValue)
int value matching a specified key.getIntValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.int value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public int getIntValue(String key)
int value matching a specified key.getIntValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.int value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public long getLongValue(String key, long defaultValue)
long value matching a specified key.getLongValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.long value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public long getLongValue(String key)
long value matching a specified key.getLongValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.long value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public float getFloatValue(String key, float defaultValue)
float value matching a specified key.getFloatValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.float value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public float getFloatValue(String key)
float value matching a specified key.getFloatValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.float value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public double getDoubleValue(String key, double defaultValue)
double value matching a specified key.getDoubleValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.double value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public double getDoubleValue(String key)
double value matching a specified key.getDoubleValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.double value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public boolean getBooleanValue(String key, boolean defaultValue)
boolean value matching a specified key.getBooleanValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.boolean value matching the specified key; returns the defaultValue if no
value matching the key is found or a value of another type is found.public boolean getBooleanValue(String key)
boolean value matching a specified key.getBooleanValue 在类中 BasePacMapkey - Indicates the key in String format, which can be null.boolean value matching the specified key; returns false if no value matching
the key is found or a value of another type is found.public char getChar(String key, char defaultValue)
char value matching a specified key.getChar 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.char value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public char getChar(String key)
char value matching a specified key.getChar 在类中 BasePacMapkey - Indicates the key in String format, which can be null.char value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public String getString(String key, String defaultValue)
String value matching a specified key.getString 在类中 BasePacMapkey - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.String value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public String getString(String key)
String value matching a specified key.getString 在类中 BasePacMapkey - Indicates the key in String format, which can be null.String value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public byte[] getByteValueArray(String key)
byte[] value matching a specified key.getByteValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.byte[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public short[] getShortValueArray(String key)
short[] value matching a specified key.getShortValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.short[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public int[] getIntValueArray(String key)
int[] value matching a specified key.getIntValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.int[] value matching the specified key; returns null if no value matching the
key is found or a value of another type is found.public ArrayList<Integer> getIntegerList(String key)
ArrayList<Integer> value matching a specified key.key - Indicates the key in String format, which can be null.ArrayList<Integer> value matching the specified key; returns null if no value
matching the key is found or a value of another type is found.public long[] getLongValueArray(String key)
long[] value matching a specified key.getLongValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.long[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public float[] getFloatValueArray(String key)
float[] value matching a specified key.getFloatValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.float[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public double[] getDoubleValueArray(String key)
double[] value matching a specified key.getDoubleValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.double[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public boolean[] getBooleanValueArray(String key)
boolean[] value matching a specified key.getBooleanValueArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.boolean[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public char[] getCharArray(String key)
char[] value matching a specified key.getCharArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.char[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public String[] getStringArray(String key)
String[] value matching a specified key.getStringArray 在类中 BasePacMapkey - Indicates the key in String format, which can be null.String[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public ArrayList<String> getStringList(String key)
ArrayList<String> value matching a specified key.key - Indicates the key in String format, which can be null.ArrayList<String> value matching the specified key; returns null if no value
matching the key is found or a value of another type is found.public Optional<PacMap> getPacMap(String key)
PacMap value matching a specified key.key - Indicates the key in String format, which can be null.PacMap value, which is encapsulated in Optional; returns null if no
value matching the key is found or a value of another type is found.public Optional<Serializable> getSerializable(String key)
Serializable value matching a specified key.key - Indicates the key in String format, which can be null.Serializable value, which is encapsulated in Optional; returns null
if no value matching the key is found or a value of another type is found.public Optional<Sequenceable> getSequenceable(String key)
Sequenceable value matching a specified key.key - Indicates the key in String format, which can be null.Seqenceable value, which is encapsulated in Optional; returns null if
no value matching the key is found or a value of another type is found.public Sequenceable[] getSequenceableArray(String key)
Sequenceable[] value matching a specified key.key - Indicates the key in String format, which can be null.Sequenceable[] value matching the specified key; returns null if no value
matching the key is found or a value of another type is found.public ArrayList<Sequenceable> getSequenceableList(String key)
ArrayList<Sequenceable> value matching a specified key.key - Indicates the key in String format, which can be null.ArrayList<Sequenceable> value matching the specified key; returns null if no
value matching the key is found or a value of another type is found.public int getSize()
getSize 在类中 BasePacMappublic boolean isEmpty()
isEmpty 在类中 BasePacMaptrue if the current object is empty; returns false otherwise.public Set<String> getKeys()
getKeys 在类中 BasePacMappublic boolean hasKey(String key)
hasKey 在类中 BasePacMapkey - Indicates the key in String format, which can be null.true if the key is contained; returns false otherwise.public void remove(String key)
remove 在类中 BasePacMapkey - Indicates the key in String format, which can be null.public void clear()
clear 在类中 BasePacMappublic boolean marshalling(Parcel out)
Sequenceable object into a Parcel.marshalling 在接口中 Sequenceablemarshalling 在类中 BasePacMapout - Indicates the Parcel object to which the Sequenceable
object will be marshaled.true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
Sequenceable object from a Parcel.unmarshalling 在接口中 Sequenceableunmarshalling 在类中 BasePacMapin - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.public boolean equals(Object object)
Object
The equals method implements an equivalence relation
on non-null object references:
x, x.equals(x) should return
true.
x and y, x.equals(y)
should return true if and only if
y.equals(x) returns true.
x, y, and z, if
x.equals(y) returns true and
y.equals(z) returns true, then
x.equals(z) should return true.
x and y, multiple invocations of
x.equals(y) consistently return true
or consistently return false, provided no
information used in equals comparisons on the
objects is modified.
x,
x.equals(null) should return false.
The equals method for class Object implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x and
y, this method returns true if and only
if x and y refer to the same object
(x == y has the value true).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode method, which states
that equal objects must have equal hash codes.
equals 在类中 BasePacMapobject - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
HashMappublic int hashCode()
ObjectHashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
hashCode 在类中 BasePacMapObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public Object clone() throws CloneNotSupportedException
Objectx, the expression:
will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x)
true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone. If a class and all of its superclasses (except
Object) obey this convention, it will be the case that
x.clone().getClass() == x.getClass().
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by super.clone before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by super.clone
need to be modified.
The method clone for class Object performs a
specific cloning operation. First, if the class of this object does
not implement the interface Cloneable, then a
CloneNotSupportedException is thrown. Note that all arrays
are considered to implement the interface Cloneable and that
the return type of the clone method of an array type T[]
is T[] where T is any reference or primitive type.
Otherwise, this method creates a new instance of the class of this
object and initializes all its fields with exactly the contents of
the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method
performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object does not itself implement the interface
Cloneable, so calling the clone method on an object
whose class is Object will result in throwing an
exception at run time.
clone 在类中 BasePacMapCloneNotSupportedException - if the object's class does not
support the Cloneable interface. Subclasses
that override the clone method can also
throw this exception to indicate that an instance cannot
be cloned.Cloneablepublic PacMap deepCopy()
PacMap object.
A deep copy is performed to create an object with the same content as the original one.
Note: Deep copy only support primitive data types, Object, array of them, and PacMap.
PacMap object.