Java - hashCode Method

> Procedural Languages > Java

1 - About

If two objects are equal, they must have the same hashCode() output.

3 - Utility

3.1 - org.apache.commons.lang.builder

package org.apache.commons.lang.builder;
HashCodeBuilder builder = new HashCodeBuilder(17, 37);
 
builder.append(name);
if (table!=null){
	//TODO: May be implementation of an URI for each database object
	builder.append(table.getName());
	builder.append(table.getSchemaObject().getName());
	builder.append(table.getSchemaObject().getCatalog().getName());
	builder.append(table.getSchemaObject().getCatalog().getPlatform().getName());
}
 
 
return builder.toHashCode();
Advertising
lang/java/hashcode.txt · Last modified: 2017/02/12 21:05 by gerardnico