com.googlecode.concurrenttrees.radix
Class ConcurrentRadixTree.KeyValuePairImpl<O>

java.lang.Object
  extended by com.googlecode.concurrenttrees.radix.ConcurrentRadixTree.KeyValuePairImpl<O>
All Implemented Interfaces:
KeyValuePair<O>
Enclosing class:
ConcurrentRadixTree<O>

public static class ConcurrentRadixTree.KeyValuePairImpl<O>
extends Object
implements KeyValuePair<O>

Implementation of the KeyValuePair interface.


Constructor Summary
ConcurrentRadixTree.KeyValuePairImpl(String key, Object value)
          Constructor.
 
Method Summary
 boolean equals(Object o)
          Compares this KeyValuePair object with another for equality.
 CharSequence getKey()
          Returns the key with which the value is associated
 O getValue()
          Returns the value associated with the key
 int hashCode()
          Returns a hash code for this object.
 String toString()
          Returns a string representation as (key, value).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConcurrentRadixTree.KeyValuePairImpl

public ConcurrentRadixTree.KeyValuePairImpl(String key,
                                            Object value)
Constructor. Implementation node: This constructor currently requires the key to be supplied as a String - this is to allow reliable testing of object equality; the alternative CharSequence does not specify a contract for Object.equals(Object).

Parameters:
key - The key as a string
value - The value
Method Detail

getKey

public CharSequence getKey()
Returns the key with which the value is associated

Specified by:
getKey in interface KeyValuePair<O>
Returns:
The key with which the value is associated

getValue

public O getValue()
Returns the value associated with the key

Specified by:
getValue in interface KeyValuePair<O>
Returns:
The value associated with the key

equals

public boolean equals(Object o)
Compares this KeyValuePair object with another for equality.

This is implemented based on equality of the keys.

Specified by:
equals in interface KeyValuePair<O>
Overrides:
equals in class Object
Parameters:
o - The other object to compare
Returns:
True if the other object is also a KeyValuePair and is equal to this one as specified above

hashCode

public int hashCode()
Returns a hash code for this object.

Specified by:
hashCode in interface KeyValuePair<O>
Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation as (key, value).

Specified by:
toString in interface KeyValuePair<O>
Overrides:
toString in class Object
Returns:
A string representation as (key, value)


Copyright © 2013. All Rights Reserved.