Class CharArrayMap<P>
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.util.CharArrayMap<P>
- All Implemented Interfaces:
Cloneable,CharArrayMapper<P>
This map avoids hashing. This is suitable for few elements or long char arrays because it uses vectorized equals.
Vectorized equals is several times faster then calculating hashCode in a loop. This class is not thread safe and
callers are responsible for thread safety.
- Author:
- jkubitz
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(char[] key) get(char[] key) Collection<char[]> keys()Returns a copied collection of keys.intsize()toString()values()Returns a copied collection of values.
-
Constructor Details
-
CharArrayMap
public CharArrayMap() -
CharArrayMap
public CharArrayMap(int estimatedSize)
-
-
Method Details
-
values
Description copied from interface:CharArrayMapperReturns a copied collection of values.- Specified by:
valuesin interfaceCharArrayMapper<P>- Returns:
- all values in undefined order. The order is not guaranteed to be stable.
-
keys
Description copied from interface:CharArrayMapperReturns a copied collection of keys.- Specified by:
keysin interfaceCharArrayMapper<P>- Returns:
- all keys in undefined order. The order is not guaranteed to be stable.
-
containsKey
public boolean containsKey(char[] key) - Specified by:
containsKeyin interfaceCharArrayMapper<P>
-
get
- Specified by:
getin interfaceCharArrayMapper<P>
-
put
- Specified by:
putin interfaceCharArrayMapper<P>- Returns:
- the previous value
-
size
public int size()- Specified by:
sizein interfaceCharArrayMapper<P>- Returns:
- the number of keys
-
toString
-