( ?) !
. .
SomeClass
, , nInstanceCount
:
iD = nInstanceCount++;
- ,
int hashCode(){
return iD;
}
,
boolean equals( Object obj ){
if( ! ( obj instanceof SomeClass )){
return false;
}
return hashCode() == obj.hashCode();
}
... , "equals is overlluous" : , Java 10 ( Java 23) , , equals
, ? ( NB ).
:
, , , , , ""? : - "" , HashMap
. : , "" , HashMap
, . , , ( ) , hashCode()
!