Package fj
Class Hash<A>
java.lang.Object
fj.Hash<A>
Produces a hash code for an object which should attempt uniqueness.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Hash<BigDecimal> A hash instance for theBigDecimaltype.static final Hash<BigInteger> A hash instance for theBigIntegertype.A hash instance for thebooleantype.A hash instance for thebytetype.A hash instance for thechartype.A hash instance for thedoubletype.A hash instance for thefloattype.A hash instance for theinttype.A hash instance for thelongtype.A hash instance for theNaturaltype.A hash instance for theshorttype.static final Hash<StringBuffer> A hash instance for theStringBuffertype.static final Hash<StringBuilder> A hash instance for theStringBuildertype.A hash instance for theStringtype. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> Hash<A> anyHash()A hash that usesObject.hashCode().A hash instance for theArraytype.<B> Hash<B> Maps the given function across this hash as a contra-variant functor.either3Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc) eitherHash(Hash<A> ha, Hash<B> hb) A hash instance for theEithertype.intCompute the hash of the given value.static <A> Hash<A> Construct a hash with the given hash function.A hash instance for theListtype.static <A> Hash<NonEmptyList<A>> nonEmptyListHash(Hash<A> ha) A hash instance for theNonEmptyListtype.optionHash(Hash<A> ha) A hash instance for theOptiontype.A hash instance for a product-1.A hash instance for a product-2.A hash instance for a product-3.A hash instance for a product-4.A hash instance for a product-5.A hash instance for a product-6.A hash instance for a product-7.p8Hash(Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he, Hash<F$> hf, Hash<G> hg, Hash<H> hh) A hash instance for a product-8.resultHash(Hash<A> ha, Hash<I> hi) A hash instance for theResulttype.streamHash(Hash<A> ha) A hash instance for theStreamtype.A hash instance for theTreetype.treeMapHash(Hash<K> h, Hash<V> v) static <A> Hash<TreeZipper<A>> treeZipperHash(Hash<A> ha) A hash instance for theTreeZippertype.A hash instance for a vector-2.A hash instance for a vector-3.A hash instance for a vector-4.A hash instance for a vector-5.A hash instance for a vector-6.A hash instance for a vector-7.A hash instance for a vector-8.static <A,B> Hash <Validation<A, B>> validationHash(Hash<A> ha, Hash<B> hb) A hash instance for theValidationtype.zipperHash(Hash<A> ha) A hash instance for theZippertype.
-
Field Details
-
f
-
booleanHash
A hash instance for thebooleantype. -
byteHash
A hash instance for thebytetype. -
charHash
A hash instance for thechartype. -
doubleHash
A hash instance for thedoubletype. -
floatHash
A hash instance for thefloattype. -
intHash
A hash instance for theinttype. -
longHash
A hash instance for thelongtype. -
shortHash
A hash instance for theshorttype. -
bigintHash
A hash instance for theBigIntegertype. -
bigdecimalHash
A hash instance for theBigDecimaltype. -
naturalHash
A hash instance for theNaturaltype. -
stringHash
A hash instance for theStringtype. -
stringBufferHash
A hash instance for theStringBuffertype. -
stringBuilderHash
A hash instance for theStringBuildertype.
-
-
Constructor Details
-
Hash
-
-
Method Details
-
hash
Compute the hash of the given value.- Parameters:
a- The value to compute the hash value for.- Returns:
- The hash value.
-
contramap
Maps the given function across this hash as a contra-variant functor.- Parameters:
g- The function to map.- Returns:
- A new hash.
-
hash
Construct a hash with the given hash function.- Parameters:
f- The function to construct the hash with.- Returns:
- A hash that uses the given function.
-
anyHash
A hash that usesObject.hashCode().- Returns:
- A hash that uses
Object.hashCode().
-
eitherHash
A hash instance for theEithertype.- Parameters:
ha- Hash the left side ofEither.hb- Hash the right side ofEither.- Returns:
- A hash instance for the
Eithertype.
-
either3Hash
-
resultHash
A hash instance for theResulttype.- Parameters:
ha- Hash theResultvalue.hi- Hash theResultremainder.- Returns:
- A hash instance for the
Resulttype.
-
validationHash
A hash instance for theValidationtype.- Parameters:
ha- Hash the failing side ofValidation.hb- Hash the succeeding side ofValidation.- Returns:
- A hash instance for the
Validationtype.
-
listHash
A hash instance for theListtype.- Parameters:
ha- A hash for the elements of the list.- Returns:
- A hash instance for the
Listtype.
-
nonEmptyListHash
A hash instance for theNonEmptyListtype.- Parameters:
ha- A hash for the elements of the non-empty list.- Returns:
- A hash instance for the
NonEmptyListtype.
-
optionHash
A hash instance for theOptiontype.- Parameters:
ha- A hash for the element of the optional value.- Returns:
- A hash instance for the
Optiontype.
-
seqHash
-
setHash
-
streamHash
A hash instance for theStreamtype.- Parameters:
ha- A hash for the elements of the stream.- Returns:
- A hash instance for the
Streamtype.
-
arrayHash
A hash instance for theArraytype.- Parameters:
ha- A hash for the elements of the array.- Returns:
- A hash instance for the
Arraytype.
-
zipperHash
A hash instance for theZippertype.- Parameters:
ha- A hash for the elements of the zipper.- Returns:
- A hash instance for the
Zippertype.
-
treeZipperHash
A hash instance for theTreeZippertype.- Parameters:
ha- A hash for the elements of the tree zipper.- Returns:
- A hash instance for the
TreeZippertype.
-
treeHash
A hash instance for theTreetype.- Parameters:
ha- A hash for the elements of the tree.- Returns:
- A hash instance for the
Treetype.
-
treeMapHash
-
p1Hash
A hash instance for a product-1.- Parameters:
ha- A hash for the first element of the product.- Returns:
- A hash instance for a product-1.
-
p2Hash
A hash instance for a product-2.- Parameters:
ha- A hash for the first element of the product.hb- A hash for the second element of the product.- Returns:
- A hash instance for a product-2.
-
p3Hash
A hash instance for a product-3.- Parameters:
ha- A hash for the first element of the product.hb- A hash for the second element of the product.hc- A hash for the third element of the product.- Returns:
- A hash instance for a product-3.
-
p4Hash
A hash instance for a product-4.- Parameters:
ha- A hash for the first element of the product.hb- A hash for the second element of the product.hc- A hash for the third element of the product.hd- A hash for the fourth element of the product.- Returns:
- A hash instance for a product-4.
-
p5Hash
public static <A,B, Hash<P5<A,C, D, E> B, p5HashC, D, E>> (Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he) A hash instance for a product-5.- Parameters:
ha- A hash for the first element of the product.hb- A hash for the second element of the product.hc- A hash for the third element of the product.hd- A hash for the fourth element of the product.he- A hash for the fifth element of the product.- Returns:
- A hash instance for a product-5.
-
p6Hash
public static <A,B, Hash<P6<A,C, D, E, F$> B, p6HashC, D, E, F$>> (Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he, Hash<F$> hf) A hash instance for a product-6.- Parameters:
ha- A hash for the first element of the product.hb- A hash for the second element of the product.hc- A hash for the third element of the product.hd- A hash for the fourth element of the product.he- A hash for the fifth element of the product.hf- A hash for the sixth element of the product.- Returns:
- A hash instance for a product-6.
-
p7Hash
public static <A,B, Hash<P7<A,C, D, E, F$, G> B, p7HashC, D, E, F$, G>> (Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he, Hash<F$> hf, Hash<G> hg) A hash instance for a product-7.- Parameters:
ha- A hash for the first element of the product.hb- A hash for the second element of the product.hc- A hash for the third element of the product.hd- A hash for the fourth element of the product.he- A hash for the fifth element of the product.hf- A hash for the sixth element of the product.hg- A hash for the seventh element of the product.- Returns:
- A hash instance for a product-7.
-
p8Hash
public static <A,B, Hash<P8<A,C, D, E, F$, G, H> B, p8HashC, D, E, F$, G, H>> (Hash<A> ha, Hash<B> hb, Hash<C> hc, Hash<D> hd, Hash<E> he, Hash<F$> hf, Hash<G> hg, Hash<H> hh) A hash instance for a product-8.- Parameters:
ha- A hash for the first element of the product.hb- A hash for the second element of the product.hc- A hash for the third element of the product.hd- A hash for the fourth element of the product.he- A hash for the fifth element of the product.hf- A hash for the sixth element of the product.hg- A hash for the seventh element of the product.hh- A hash for the eighth element of the product.- Returns:
- A hash instance for a product-8.
-
v2Hash
A hash instance for a vector-2.- Parameters:
ea- A hash for the elements of the vector.- Returns:
- A hash instance for a vector-2.
-
v3Hash
A hash instance for a vector-3.- Parameters:
ea- A hash for the elements of the vector.- Returns:
- A hash instance for a vector-3.
-
v4Hash
A hash instance for a vector-4.- Parameters:
ea- A hash for the elements of the vector.- Returns:
- A hash instance for a vector-4.
-
v5Hash
A hash instance for a vector-5.- Parameters:
ea- A hash for the elements of the vector.- Returns:
- A hash instance for a vector-5.
-
v6Hash
A hash instance for a vector-6.- Parameters:
ea- A hash for the elements of the vector.- Returns:
- A hash instance for a vector-6.
-
v7Hash
A hash instance for a vector-7.- Parameters:
ea- A hash for the elements of the vector.- Returns:
- A hash instance for a vector-7.
-
v8Hash
A hash instance for a vector-8.- Parameters:
ea- A hash for the elements of the vector.- Returns:
- A hash instance for a vector-8.
-