mirror of
https://github.com/tursom/GoCollections.git
synced 2025-02-26 20:20:31 +08:00
16 lines
345 B
Go
16 lines
345 B
Go
package collections
|
|
|
|
import (
|
|
"github.com/tursom/GoCollections/exceptions"
|
|
"github.com/tursom/GoCollections/lang"
|
|
)
|
|
|
|
func HashIterable[E lang.Object](iterable Iterable[E]) int32 {
|
|
hashCode := int32(0)
|
|
_ = Loop(iterable, func(element E) exceptions.Exception {
|
|
hashCode = hashCode*31 ^ element.HashCode()
|
|
return nil
|
|
})
|
|
return hashCode
|
|
}
|