Top Description Fields Constructors Methods
org.python.core

pack-priv Class PyToJavaMapEntry

Located in compilation unit of org.python.core.AbstractDict.

extends SimpleEntry
Class Inheritance

Wrapper for a Entry object returned from the java.util.Set object which in turn is returned by the entrySet method of java.util.Map. This is needed to correctly convert from PyObjects to java Objects. Note that we take care in the equals and hashCode methods to make sure these methods are consistent with Entry objects that contain java Objects for a value so that on the java side they can be reliable compared.

Field Summary

Inherited from org.python.core.SimpleEntry:
keyvalue

Constructor Summary

AccessConstructor and Description
pack-priv
PyToJavaMapEntry(Map.Entry<K, V> entry)

Create a copy of the Entry with Py.None converted to null

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
object to be compared for equality with this map entry
o
)

Overrides org.python.core.SimpleEntry.equals.

Implements java.util.Map.Entry.equals.

Compares the specified object with this entry for equality.

public Map.Entry<K, V>

Returns:

an entry that returns the original values given to this entry.
getEntry
()

public Object
getKey()

Overrides org.python.core.SimpleEntry.getKey.

Implements java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

public Object
getValue()

Overrides org.python.core.SimpleEntry.getValue.

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.

public int
hashCode()

Overrides org.python.core.SimpleEntry.hashCode.

Implements java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry.

Inherited from org.python.core.SimpleEntry:
setValuetoString

Constructor Detail

PyToJavaMapEntryback to summary
pack-priv PyToJavaMapEntry(Map.Entry<K, V> entry)

Create a copy of the Entry with Py.None converted to null

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides org.python.core.SimpleEntry.equals.

Implements java.util.Map.Entry.equals.

Doc from java.util.Map.Entry.equals.

Compares the specified object with this entry for equality. Returns true if the given object is also a map entry and the two entries represent the same mapping. More formally, two entries e1 and e2 represent the same mapping if

    (e1.getKey()==null ?
     e2.getKey()==null : e1.getKey().equals(e2.getKey()))  &&
    (e1.getValue()==null ?
     e2.getValue()==null : e1.getValue().equals(e2.getValue()))
This ensures that the equals method works properly across different implementations of the Map.Entry interface.
Parameters
o:Object

object to be compared for equality with this map entry

Returns:boolean

true if the specified object is equal to this map entry

Annotations
@Override

getEntryback to summary
public Map.Entry<K, V> getEntry()
Returns:Map.Entry<K, V>

an entry that returns the original values given to this entry.

getKeyback to summary
public Object getKey()

Overrides org.python.core.SimpleEntry.getKey.

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:Object

the key corresponding to this entry

Annotations
@Override

getValueback to summary
public Object getValue()

Overrides org.python.core.SimpleEntry.getValue.

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:Object

the value corresponding to this entry

Annotations
@Override

hashCodeback to summary
public int hashCode()

Overrides org.python.core.SimpleEntry.hashCode.

Implements java.util.Map.Entry.hashCode.

Doc from java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry. The hash code of a map entry e is defined to be:

    (e.getKey()==null   ? 0 : e.getKey().hashCode()) ^
    (e.getValue()==null ? 0 : e.getValue().hashCode())
This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two Entries e1 and e2, as required by the general contract of Object.hashCode.
Returns:int

the hash code value for this map entry

Annotations
@Override