Top Description Fields Methods
io.netty.util

public Interface HashingStrategy<T>


Abstraction for hash code generation and equality comparison.

Field Summary

Modifier and TypeField and Description
public static final HashingStrategy<T>

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(T a, T b)

Returns true if the arguments are equal to each other and false otherwise.

public int
hashCode(T obj)

Generate a hash code for obj.

Field Detail

JAVA_HASHERback to summary
public static final HashingStrategy<T> JAVA_HASHER

A HashingStrategy which delegates to java's Object#hashCode() and Object#equals(Object).

Annotations
@SuppressWarnings:rawtypes

Method Detail

equalsback to summary
public boolean equals(T a, T b)

Returns true if the arguments are equal to each other and false otherwise. This method has the following restrictions:

  • reflexive - equals(a, a) should return true
  • symmetric - equals(a, b) returns true if equals(b, a) returns true
  • transitive - if equals(a, b) returns true and equals(a, c) returns true then equals(b, c) should also return true
  • consistent - equals(a, b) should return the same result when called multiple times assuming a and b remain unchanged relative to the comparison criteria
  • if a and b are both null then this method returns true
  • if a is null and b is non-null, or a is non-null and b is null then this method returns false
hashCodeback to summary
public int hashCode(T obj)

Generate a hash code for obj.

This method must obey the same relationship that java.lang.Object#hashCode() has with java.lang.Object#equals(Object):

  • Calling this method multiple times with the same obj should return the same result
  • If equals(Object, Object) with parameters a and b returns true then the return value for this method for parameters a and b must return the same result
  • If equals(Object, Object) with parameters a and b returns false then the return value for this method for parameters a and b does not have to return different results results. However this property is desirable.
  • if obj is null then this method return 0