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
,Empty
,EmptyTable
,EqConstHashEnum
,EqConstHashTable
,EqConstHashTable.Keys
,EqConstHashTable.Values
,EqConstList
,EscapeHandler.Default
,KeyValue.Default
,LinkingReferencing.Default
,StorageConfiguration.Default
,XCsvConfiguration.Default
,XCsvParserCharArray
public interface HashImmutable
Marker type to indicate that all fields (the state) used in the implementation of
equals(Object)
and hashCode()
are immutable (will never change) and thus the results of equals(Object)
and hashCode()
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()
, because Object.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 neither Object.equals(Object)
nor Object.hashCode()
,
as implementations overriding them are potentially broken in terms of the required behavior (e.g. JDK
implementations of Collection
are).
For those cases, use an externally defined Equalator
or HashEqualator
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 Details
-
equals
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)
-