public static final class CrossHash.Wisp
extends java.lang.Object
String.hashCode()
(which also does badly, though not as badly), while other hashes here do fine (such as
Water, which is the default for CrossHash.hash(CharSequence)
).
CrossHash.Water
is about 20% slower but doesn't have such categories of
pathologically bad inputs, and passes tests that Wisp fails badly on. Because the hash-based collections in
SquidLib need a pretty good hash function to work at their best (they use linear-probing with open addressing,
which struggles when hashes are bad), 20% loss of speed during hashing to avoid slower
lookups/insertions/deletions from OrderedMap
, OrderedSet
, UnorderedMap
,
UnorderedSet
, Arrangement
, and others is probably worth it; if you really need speed then you
should first consider CrossHash.Curlup
, which is faster than Wisp on moderately-long input arrays (with 20 or more
items, usually), and only if you need a fast hash for small inputs, where collisions aren't a problem, should you
turn to Wisp.Constructor and Description |
---|
Wisp() |
Modifier and Type | Method and Description |
---|---|
static int |
hash(boolean[] data) |
static int |
hash(byte[] data) |
static int |
hash(char[] data) |
static int |
hash(char[][] data) |
static int |
hash(char[] data,
int start,
int end)
Hashes only a subsection of the given data, starting at start (inclusive) and ending before end (exclusive).
|
static int |
hash(char[] data,
int start,
int end,
int step)
Hashes only a subsection of the given data, starting at start (inclusive), ending before end (exclusive), and
moving between chars in increments of step (which is always greater than 0).
|
static int |
hash(java.lang.CharSequence data) |
static int |
hash(java.lang.CharSequence[]... data) |
static int |
hash(java.lang.CharSequence[] data) |
static int |
hash(double[] data) |
static int |
hash(float[] data) |
static int |
hash(int[] data) |
static int |
hash(int[][] data) |
static int |
hash(java.lang.Iterable<? extends java.lang.CharSequence> data) |
static int |
hash(java.util.List<? extends java.lang.CharSequence> data) |
static int |
hash(long[] data) |
static int |
hash(long[][] data) |
static int |
hash(java.lang.Object data) |
static int |
hash(java.lang.Object[] data) |
static int |
hash(short[] data) |
static int |
hash32(boolean[] data) |
static int |
hash32(byte[] data) |
static int |
hash32(char[] data) |
static int |
hash32(char[][] data) |
static int |
hash32(char[] data,
int start,
int end)
Hashes only a subsection of the given data, starting at start (inclusive) and ending before end (exclusive).
|
static int |
hash32(java.lang.CharSequence data) |
static int |
hash32(java.lang.CharSequence[]... data) |
static int |
hash32(java.lang.CharSequence[] data) |
static int |
hash32(double[] data) |
static int |
hash32(float[] data) |
static int |
hash32(int[] data) |
static int |
hash32(int[][] data) |
static int |
hash32(java.lang.Iterable<? extends java.lang.CharSequence> data) |
static int |
hash32(java.util.List<? extends java.lang.CharSequence> data) |
static int |
hash32(long[] data) |
static int |
hash32(long[][] data) |
static int |
hash32(java.lang.Object data) |
static int |
hash32(java.lang.Object[] data) |
static int |
hash32(short[] data) |
static long |
hash64(boolean[] data) |
static long |
hash64(byte[] data) |
static long |
hash64(char[] data) |
static long |
hash64(char[][] data) |
static long |
hash64(char[] data,
int start,
int end)
Hashes only a subsection of the given data, starting at start (inclusive) and ending before end (exclusive).
|
static long |
hash64(char[] data,
int start,
int end,
int step)
Hashes only a subsection of the given data, starting at start (inclusive), ending before end (exclusive), and
moving between chars in increments of step (which is always greater than 0).
|
static long |
hash64(java.lang.CharSequence data) |
static long |
hash64(java.lang.CharSequence[]... data) |
static long |
hash64(java.lang.CharSequence[] data) |
static long |
hash64(double[] data) |
static long |
hash64(float[] data) |
static long |
hash64(int[] data) |
static long |
hash64(int[][] data) |
static long |
hash64(java.lang.Iterable<? extends java.lang.CharSequence> data) |
static long |
hash64(java.util.List<? extends java.lang.CharSequence> data) |
static long |
hash64(long[] data) |
static long |
hash64(long[][] data) |
static long |
hash64(java.lang.Object data) |
static long |
hash64(java.lang.Object[] data) |
static long |
hash64(short[] data) |
public static long hash64(boolean[] data)
public static long hash64(byte[] data)
public static long hash64(short[] data)
public static long hash64(char[] data)
public static long hash64(int[] data)
public static long hash64(long[] data)
public static long hash64(float[] data)
public static long hash64(double[] data)
public static long hash64(java.lang.CharSequence data)
public static long hash64(char[] data, int start, int end)
data
- the char array to hashstart
- the start of the section to hash (inclusive)end
- the end of the section to hash (exclusive)public static long hash64(char[] data, int start, int end, int step)
data
- the char array to hashstart
- the start of the section to hash (inclusive)end
- the end of the section to hash (exclusive)step
- how many elements to advance after using one element from data; must be greater than 0public static long hash64(char[][] data)
public static long hash64(int[][] data)
public static long hash64(long[][] data)
public static long hash64(java.lang.CharSequence[] data)
public static long hash64(java.lang.CharSequence[]... data)
public static long hash64(java.lang.Iterable<? extends java.lang.CharSequence> data)
public static long hash64(java.util.List<? extends java.lang.CharSequence> data)
public static long hash64(java.lang.Object[] data)
public static long hash64(java.lang.Object data)
public static int hash32(boolean[] data)
public static int hash32(byte[] data)
public static int hash32(short[] data)
public static int hash32(char[] data)
public static int hash32(int[] data)
public static int hash32(long[] data)
public static int hash32(float[] data)
public static int hash32(double[] data)
public static int hash32(java.lang.CharSequence data)
public static int hash32(char[] data, int start, int end)
data
- the char array to hashstart
- the start of the section to hash (inclusive)end
- the end of the section to hash (exclusive)public static int hash32(char[][] data)
public static int hash32(int[][] data)
public static int hash32(long[][] data)
public static int hash32(java.lang.CharSequence[] data)
public static int hash32(java.lang.CharSequence[]... data)
public static int hash32(java.lang.Iterable<? extends java.lang.CharSequence> data)
public static int hash32(java.util.List<? extends java.lang.CharSequence> data)
public static int hash32(java.lang.Object[] data)
public static int hash32(java.lang.Object data)
public static int hash(boolean[] data)
public static int hash(byte[] data)
public static int hash(short[] data)
public static int hash(char[] data)
public static int hash(int[] data)
public static int hash(long[] data)
public static int hash(float[] data)
public static int hash(double[] data)
public static int hash(java.lang.CharSequence data)
public static int hash(char[] data, int start, int end)
data
- the char array to hashstart
- the start of the section to hash (inclusive)end
- the end of the section to hash (exclusive)public static int hash(char[] data, int start, int end, int step)
data
- the char array to hashstart
- the start of the section to hash (inclusive)end
- the end of the section to hash (exclusive)step
- how many elements to advance after using one element from data; must be greater than 0public static int hash(char[][] data)
public static int hash(int[][] data)
public static int hash(long[][] data)
public static int hash(java.lang.CharSequence[] data)
public static int hash(java.lang.CharSequence[]... data)
public static int hash(java.lang.Iterable<? extends java.lang.CharSequence> data)
public static int hash(java.util.List<? extends java.lang.CharSequence> data)
public static int hash(java.lang.Object[] data)
public static int hash(java.lang.Object data)
Copyright © Eben Howard 2012–2022. All rights reserved.