V
- public final class CharArrayMap<V> extends Object
Constructor and Description |
---|
CharArrayMap()
Constructs an empty CharArrayMap with default initial capacity.
|
CharArrayMap(int initialCapacity)
Constructs an empty CharArrayMap with the given initial capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all mappings from the map.
|
boolean |
containsKey(char[] chars)
Returns true if the given key has a value associated with it in the map.
|
boolean |
containsKey(char[] chars,
int start,
int length)
Returns true if the given key has a value associated with it in the map.
|
boolean |
containsValue(V value)
Returns true if the given value is contained in the map.
|
static <V> CharArrayMap<V> |
createOrderedMap()
Static factory method that constructs an empty CharArrayMap with default initial capacity,
and the map will be kept in ascending key order.
|
V |
get(char[] chars)
Returns the value to which the specified array is mapped in this map,
or null if the map contains no mapping for this key.
|
V |
get(char[] chars,
int start,
int length)
Returns the value to which the specified array slice is mapped in this map,
or null if the map contains no mapping for this key.
|
boolean |
isEmpty()
Returns true if the map is empty.
|
Collection<char[]> |
keys()
Returns the keys stored in the map.
|
void |
put(char[] chars,
int start,
int length,
V value)
Creates a new mapping in this map, uses the given array slice as the key.
|
void |
put(char[] chars,
V value)
Creates a new mapping in this map, uses all of the given array as the key.
|
V |
remove(char[] chars)
Removes the mapping for the given array if present.
|
V |
remove(char[] chars,
int start,
int length)
Removes the mapping for the given array slice if present.
|
int |
size()
Returns the number of mappings.
|
String |
toString()
Returns a String representation of the map.
|
Collection<V> |
values()
Use this in a foreach loop.
|
public CharArrayMap()
public CharArrayMap(int initialCapacity)
IllegalArgumentException
- if the initial capacity is negativepublic static <V> CharArrayMap<V> createOrderedMap()
public void put(char[] chars, int start, int length, V value)
NullPointerException
- if chars is nullIndexOutOfBoundsException
- if the boundaries specified by start and length are out of rangepublic void put(char[] chars, V value)
NullPointerException
- if chars is nullpublic V get(char[] chars, int start, int length)
NullPointerException
- if chars is nullIndexOutOfBoundsException
- if the boundaries specified by start and length are out of rangepublic V get(char[] chars)
NullPointerException
- if chars is nullpublic V remove(char[] chars, int start, int length)
NullPointerException
- if chars is nullIndexOutOfBoundsException
- if the boundaries specified by start and length are out of rangepublic V remove(char[] chars)
NullPointerException
- if chars is nullpublic boolean containsKey(char[] chars, int start, int length)
NullPointerException
- if chars is nullIndexOutOfBoundsException
- if the boundaries specified by start and length are out of rangepublic boolean containsKey(char[] chars)
NullPointerException
- if chars is nullpublic boolean containsValue(V value)
public Collection<V> values()
public Collection<char[]> keys()
public void clear()
public int size()
public boolean isEmpty()
Copyright (c) IBM Corp. and others 2004, 2020. All Rights Reserved.