Package one.microstream.hashing
Interface HashImmutable
-
- All Known Subinterfaces:
Immutable
,Stateless
,ValueType
,XImmutableBag<E>
,XImmutableCollection<E>
,XImmutableEnum<E>
,XImmutableList<E>
,XImmutableMap<K,V>
,XImmutableMap.Keys<K,V>
,XImmutableMap.Values<K,V>
,XImmutableSequence<E>
,XImmutableSet<E>
,XImmutableTable<K,V>
,XImmutableTable.Keys<K,V>
,XImmutableTable.Values<K,V>
- All Known Implementing Classes:
BufferSizeProvider.Default
,BufferSizeProvider.Sized
,BufferSizeProviderIncremental.Default
,BufferSizeProviderIncremental.Sized
,ComProtocol.Default
,ComProtocolProvider.Default
,Constant
,ConstHashEnum
,ConstHashTable
,ConstHashTable.Keys
,ConstHashTable.Values
,ConstLinearEnum
,ConstList
,CsvConfiguration.Default
,CsvParserCharArray
,Empty
,EmptyTable
,EqConstHashEnum
,EqConstHashTable
,EqConstHashTable.Keys
,EqConstHashTable.Values
,EqConstList
,EscapeHandler.Default
,KeyValue.Default
,LinkingReferencing.Default
,StorageConfiguration.Default
public interface HashImmutable
Marker type to indicate that all fields (the state) used in the implementation ofequals(Object)
andhashCode()
are immutable (will never change) and thus the results ofequals(Object)
andhashCode()
can never change during the life span of an instance of this type.This additional contract is required to enable the proper use of
Object.equals(Object)
andObject.hashCode()
, becauseObject.hashCode()
-depending hashing depends on this behavior to remain consistent.For any type not implementing this class (or not commonly known to be immutable, like
String
,Integer
, etc.), do not rely on neitherObject.equals(Object)
norObject.hashCode()
, as implementations overriding them are potentially broken in terms of the required behavior (e.g. JDK implementations ofCollection
are).
For those cases, use an externally definedEqualator
orHashEqualator
with fitting implementation instead.
-
-
Method Summary
Modifier and Type Method Description boolean
equals(Object other)
Marker declaration to indicate that for classes of this type,Object.equals(Object)
can be properly used.int
hashCode()
Marker declaration to indicate that for classes of this type,Object.hashCode()
can be properly used.
-
-
-
Method Detail
-
equals
boolean equals(Object other)
Marker declaration to indicate that for classes of this type,Object.equals(Object)
can be properly used.- Overrides:
equals
in classObject
- Parameters:
other
- the reference object with which to compare.- Returns:
true
if this object can be treated as the same as other,false
otherwise.- See Also:
hashCode()
-
hashCode
int hashCode()
Marker declaration to indicate that for classes of this type,Object.hashCode()
can be properly used.- Overrides:
hashCode
in classObject
- Returns:
- a hash code value for this object corresponding to the implementation of
equals(Object)
- See Also:
equals(java.lang.Object)
-
-