Dresden OCL Toolkit

tudresden.ocl.injection.lib
Class HashExact

java.lang.Object
  extended bytudresden.ocl.injection.lib.HashExact

public class HashExact
extends Object

Provides static methods for calculating hash codes. These methods emulate the hashCode() methods of the corresponding classes, but calls System.identityHashCode(Object) for each contained object.


Constructor Summary
HashExact()
           
 
Method Summary
static int identityHashCode(Collection list)
          Calculates the hash code as defined in List.hashCode(), but calls System.identityHashCode(Object) for each contained object.
static int identityHashCode(Map map)
          Calculates the hash code as defined in Map.hashCode(), but calls System.identityHashCode(Object) for each contained object.
static int identityHashCode(Object[] array)
          Calculates the hash code equivalent to identityHashCode(Collection), but for arrays instead of lists.
static int identityHashCode(Set set)
          Calculates the hash code as defined in Set.hashCode(), but calls System.identityHashCode(Object) for each contained object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashExact

public HashExact()
Method Detail

identityHashCode

public static final int identityHashCode(Collection list)
Calculates the hash code as defined in List.hashCode(), but calls System.identityHashCode(Object) for each contained object. For null arguments it returns the same value as for empty lists.

Is also responsible for java.util.Collection. There it's not known, whether order and duplicates matter, so we are on the save side, if we assume so.


identityHashCode

public static final int identityHashCode(Object[] array)
Calculates the hash code equivalent to identityHashCode(Collection), but for arrays instead of lists. For null arguments it returns the same value as for empty arrays.


identityHashCode

public static final int identityHashCode(Set set)
Calculates the hash code as defined in Set.hashCode(), but calls System.identityHashCode(Object) for each contained object. For null arguments it returns the same value as for empty sets.


identityHashCode

public static final int identityHashCode(Map map)
Calculates the hash code as defined in Map.hashCode(), but calls System.identityHashCode(Object) for each contained object.

See Also:
For null arguments it returns the same value as for empty maps.

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.