public class IntHashMap<K> extends AbstractSet<K>
| Modifier and Type | Field and Description |
|---|---|
protected Object |
DEL |
protected Object[] |
keys
Holds the keys
|
protected int |
size
Holds size
|
protected int[] |
values
Holds the values
|
| Constructor and Description |
|---|
IntHashMap()
Constructor
|
IntHashMap(Collection<K> keys)
Creates an intHashMap with these keys set to 1
|
IntHashMap(K... keys)
Creates an intHashMap with these keys set to 1
|
IntHashMap(Map<K,IntHashMap<K>> map)
Creates an intHashMap with the same keys and the sizes
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Collection<K> set)
increases the counters
|
void |
add(IntHashMap<K> countBindings)
Adds all integer values up
|
boolean |
add(K e) |
boolean |
add(K key,
int delta)
Increases a value, true for 'added new key with delta as value', false
for 'increased existing value'
|
void |
addAll(IntHashMap<K> countBindings)
Adds all integer values up
|
void |
clear() |
long |
computeSum()
Computes the sum
|
boolean |
contains(Object o) |
boolean |
containsKey(Object key)
True if value is there
|
List<K> |
decreasingKeys()
returns the keys in decreasing order
|
boolean |
equals(Object o) |
protected int |
find(Object key)
Finds a key, keys[find] will be NULL if non-existent
|
int |
findMax()
Finds the maximum value
|
int |
get(Object key)
Retrieves a value
|
int |
get(Object key,
int defaultValue)
Retrieves a value
|
int |
hashCode() |
boolean |
increase(K key)
Increases a value, true for 'added new key with value 1', false for
'increased existing value'
|
List<K> |
increasingKeys()
returns the keys in increasing order
|
protected int |
index(Object key)
Returns an index where to store the object
|
protected int |
index(Object key,
int len)
Returns an index where to store the object
|
Iterator<K> |
iterator() |
PeekIterator<K> |
keys()
Returns keys.
|
static void |
main(String[] args)
Test
|
boolean |
put(K key,
int value)
Adds a key, true for 'added the key as new', false for 'overwrote
existing value'
|
protected boolean |
put(Object[] keys,
int[] values,
Object key,
int value)
Adds a key, true for 'added the key as new', false for 'overwrote
existing value'
|
IntHashMap<K> |
putAll(Object... keyValuePairs)
Creates an intHashMap from a list that contains keys and values in alternation
|
protected void |
rehash()
Rehashes
|
boolean |
remove(Object arg0) |
int |
size() |
String |
toString() |
removeAlladdAll, containsAll, isEmpty, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, isEmpty, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streamprotected Object[] keys
protected int[] values
protected int size
protected Object DEL
public IntHashMap()
public IntHashMap(K... keys)
public IntHashMap(Collection<K> keys)
public IntHashMap(Map<K,IntHashMap<K>> map)
public IntHashMap<K> putAll(Object... keyValuePairs)
protected int index(Object key, int len)
protected int index(Object key)
public int get(Object key)
protected int find(Object key)
public int get(Object key, int defaultValue)
public boolean containsKey(Object key)
public boolean add(K key, int delta)
public boolean increase(K key)
public PeekIterator<K> keys()
public boolean put(K key, int value)
protected boolean put(Object[] keys, int[] values, Object key, int value)
public boolean remove(Object arg0)
remove in interface Collection<K>remove in interface Set<K>remove in class AbstractCollection<K>protected void rehash()
public int size()
size in interface Collection<K>size in interface Set<K>size in class AbstractCollection<K>public boolean add(K e)
add in interface Collection<K>add in interface Set<K>add in class AbstractCollection<K>public void clear()
clear in interface Collection<K>clear in interface Set<K>clear in class AbstractCollection<K>public boolean contains(Object o)
contains in interface Collection<K>contains in interface Set<K>contains in class AbstractCollection<K>public void add(IntHashMap<K> countBindings)
public void addAll(IntHashMap<K> countBindings)
public void add(Collection<K> set)
public String toString()
toString in class AbstractCollection<K>public boolean equals(Object o)
equals in interface Collection<K>equals in interface Set<K>equals in class AbstractSet<K>public int hashCode()
hashCode in interface Collection<K>hashCode in interface Set<K>hashCode in class AbstractSet<K>public int findMax()
public long computeSum()
Copyright © 2018. All rights reserved.