Skip to content

Commit

Permalink
Updates comments in Equivalence.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed Mar 20, 2024
1 parent 23bef7f commit 034b619
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/com/amazon/ionelement/api/Equivalence.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ private fun AnyElement.isEquivalentTo(other: AnyElement): Boolean {
/**
* Calculates the hash code of an [IonElement].
*
* Implementations of [IonElement] MAY NOT calculate their own hash codes, but MAY cache the result of this function.
* Implementations of [IonElement] MAY NOT calculate their own hash codes. However, they MAY store the result of this
* function as a private field. The result of this function may change from one release to another—do not put this
* value in any persistent storage.
*/
public fun hashElement(ionElement: IonElement): Int {
val element = ionElement.asAnyElement()
Expand Down Expand Up @@ -121,6 +123,10 @@ public fun hashElement(ionElement: IonElement): Int {

/**
* Calculates the hash code of a [StructField].
*
* Implementations of [StructField] MAY NOT calculate their own hash codes. However, they MAY store the result of this
* function as a private field. The result of this function may change from one release to another—do not put this
* value in any persistent storage.
*/
public fun hashField(structField: StructField): Int {
return structField.name.hashCode() * 31 + structField.value.hashCode()
Expand Down

0 comments on commit 034b619

Please sign in to comment.