net.sf.mmm.util.collection.base
Class HashKey<T>

java.lang.Object
  extended by net.sf.mmm.util.collection.base.HashKey<T>
Type Parameters:
T - is the templated type of the delegate-object.

public class HashKey<T>
extends Object

This is a simple class that allows to use any object as hash-key. It only matches the exact same instance regardless of the Object.equals(Object) method of the delegate-object. Additionally it sill matches even if the delegate-object has been modified and therefore changed its hash-code.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  T delegate
           
 
Constructor Summary
HashKey(T object)
          The constructor.
 
Method Summary
 boolean equals(Object other)
          
 T getDelegate()
          This method gets the original object this hash-key delegates to.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

delegate

private T delegate
See Also:
getDelegate()
Constructor Detail

HashKey

public HashKey(T object)
The constructor.

Parameters:
object - is the delegate object.
Method Detail

getDelegate

public T getDelegate()
This method gets the original object this hash-key delegates to.

Returns:
the data object.

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object other)

Overrides:
equals in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.