Package uk.blankaspect.common.basictree
Class MapNode.Pair
java.lang.Object
uk.blankaspect.common.basictree.MapNode.Pair
- All Implemented Interfaces:
Cloneable
- Enclosing class:
- MapNode
-
Constructor Summary
ConstructorDescriptionPair
(String key, AbstractNode value) Creates a new instance of a key–value pair of a map node. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a copy of this key–value pair.boolean
Returnstrue
if the specified object is an instance ofPair
and the keys and values of the two pairs are equal to each other.getKey()
Returns the key of this key–value pair.getValue()
Returns the value of this key–value pair.int
hashCode()
Returns the hash code of this key–value pair.static void
setKeyConverter
(Function<CharSequence, String> converter) Sets the function that converts the key of a key–value pair to its string representation for thetoString()
method.toString()
Returns a string representation of this pair.
-
Constructor Details
-
Pair
Creates a new instance of a key–value pair of a map node.- Parameters:
key
- the key of the key–value pair.value
- the value of the key–value pair.
-
-
Method Details
-
setKeyConverter
Sets the function that converts the key of a key–value pair to its string representation for thetoString()
method. The default converter is the methodStringNode.escapeAndQuote(CharSequence)
.- Parameters:
converter
- the function that converts the key of a key–value pair to a string representation.
-
equals
Returnstrue
if the specified object is an instance ofPair
and the keys and values of the two pairs are equal to each other. -
hashCode
public int hashCode()Returns the hash code of this key–value pair. -
clone
Creates and returns a copy of this key–value pair. -
toString
Returns a string representation of this pair. -
getKey
Returns the key of this key–value pair.- Returns:
- the key of this key–value pair.
-
getValue
Returns the value of this key–value pair.- Returns:
- the value of this key–value pair.
-