public class DoubleHashMap<K> extends AbstractSet<K>
| Modifier and Type | Field and Description |
|---|---|
protected Object[] |
keys
Holds the keys
|
protected int |
size
Holds size
|
protected double[] |
values
Holds the values
|
| Constructor and Description |
|---|
DoubleHashMap()
Constructor
|
DoubleHashMap(K... keys)
Creates a DoubleHashMap with these keys set to 1
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Collection<K> set)
increases the counters
|
void |
add(DoubleHashMap<K> countBindings)
Adds all integer values up
|
boolean |
add(K e) |
boolean |
add(K key,
double delta)
Increases a value, true for 'added new key with delta as value', false for 'increased existing value'
|
void |
clear() |
double |
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
|
double |
findMax()
Finds the maximum value
|
double |
get(K key)
Retrieves a value
|
double |
get(K 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,
double value)
Adds a key, true for 'added the key as new', false for 'overwrote existing value'
|
protected boolean |
put(Object[] keys,
double[] values,
Object key,
double value)
Adds a key, true for 'added the key as new', false for 'overwrote existing value'
|
protected void |
rehash()
Rehashes
|
int |
size() |
String |
toString() |
removeAlladdAll, containsAll, isEmpty, remove, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streamprotected Object[] keys
protected double[] values
protected int size
public DoubleHashMap()
public DoubleHashMap(K... keys)
protected int index(Object key, int len)
protected int index(Object key)
public double get(K key)
protected int find(Object key)
public double get(K key, int defaultValue)
public boolean containsKey(Object key)
public boolean add(K key, double delta)
public boolean increase(K key)
public PeekIterator<K> keys()
public boolean put(K key, double value)
protected boolean put(Object[] keys, double[] values, Object key, double value)
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(DoubleHashMap<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 double findMax()
public double computeSum()
Copyright © 2018. All rights reserved.