Javolution 6.0.0 java
LexicalFastComparatorImpl.java
Go to the documentation of this file.
1
/*
2
* Javolution - Java(TM) Solution for Real-Time and Embedded Systems
3
* Copyright (C) 2012 - Javolution (http://javolution.org/)
4
* All rights reserved.
5
*
6
* Permission to use, copy, modify, and distribute this software is
7
* freely granted, provided that this notice is preserved.
8
*/
9
package
javolution.util.internal.comparator;
10
14
public
class
LexicalFastComparatorImpl
extends
LexicalComparatorImpl
{
15
16
private
static
final
long
serialVersionUID
= -1449702752185594025L;
17
18
@Override
19
public
int
hashCodeOf
(CharSequence csq) {
20
if
(csq ==
null
)
21
return
0;
22
int
n = csq.length();
23
if
(n == 0)
24
return
0;
25
// Hash based on 5 characters only.
26
return
csq.charAt(0) + csq.charAt(n - 1) * 31 + csq.charAt(n >> 1)
27
* 1009 + csq.charAt(n >> 2) * 27583
28
+ csq.charAt(n - 1 - (n >> 2)) * 73408859;
29
}
30
}
javolution.util.internal.comparator.LexicalComparatorImpl
Definition:
LexicalComparatorImpl.java:20
javolution.util.internal.comparator.LexicalFastComparatorImpl.hashCodeOf
int hashCodeOf(CharSequence csq)
Definition:
LexicalFastComparatorImpl.java:19
javolution.util.internal.comparator.LexicalFastComparatorImpl
Definition:
LexicalFastComparatorImpl.java:14
javolution.util.internal.comparator.LexicalFastComparatorImpl.serialVersionUID
static final long serialVersionUID
Definition:
LexicalFastComparatorImpl.java:16
core-java
src
main
java
javolution
util
internal
comparator
LexicalFastComparatorImpl.java
Generated by
1.8.18