
public class HashString extends Object implements Cloneable, Serializable, Comparable<CharSequence>, CharSequence
String and provides faster equals() at the expense
of possible errors. Internally, it computes a high quality
non-cryptographic hash (currently using Murmur 3 128bit), so be aware that
collisions may happen.| Modifier and Type | Field and Description |
|---|---|
private String |
base |
private static Charset |
CHARSET |
private static byte |
ENCODING_BASE |
private byte[] |
hash |
private int |
hash32 |
private static HashFunction |
HASHF |
private String |
s |
private static long |
serialVersionUID |
| Constructor and Description |
|---|
HashString(HashString string)
Clones this object.
|
HashString(String string) |
| Modifier and Type | Method and Description |
|---|---|
char |
charAt(int index) |
HashString |
clone() |
int |
compareTo(CharSequence o) |
private void |
computeHashes() |
boolean |
equals(HashString fs)
Overloaded method.
|
boolean |
equals(Object o) |
int |
hashCode() |
String |
hashToString() |
int |
length() |
CharSequence |
subSequence(int start,
int end) |
String |
toString() |
finalize, getClass, notify, notifyAll, wait, wait, waitchars, codePointsprivate static final Charset CHARSET
private static final byte ENCODING_BASE
private static final HashFunction HASHF
private static final long serialVersionUID
private String base
private byte[] hash
private int hash32
private final String s
public HashString(HashString string)
string - the template for the clonepublic HashString(String string)
string - the String to wrappublic char charAt(int index)
charAt in interface CharSequencepublic HashString clone()
public int compareTo(CharSequence o)
compareTo in interface Comparable<CharSequence>private void computeHashes()
public boolean equals(HashString fs)
fs - the FasterString to compare topublic String hashToString()
public int length()
length in interface CharSequencepublic CharSequence subSequence(int start, int end)
subSequence in interface CharSequencepublic String toString()
toString in interface CharSequencetoString in class Object