public class Collections
extends java.lang.Object
| Constructor and Description |
|---|
Collections() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> boolean |
addToMap(java.util.Map<K,java.util.List<V>> map,
K key,
V value)
Adds a value to a multimap, represented as a map where the values
are lists of objects.
|
static void |
main(java.lang.String[] args) |
static <T> T |
poll(java.util.Collection<T> collection)
Dequeues an element from the given collection.
|
static <T> java.util.Collection<T> |
reservoirSampling(java.util.Collection<T> someCollection,
int sampleSize)
Applies reservoir sampling to a collection of items: http://www.geeksforgeeks.org/reservoir-sampling/
|
static java.util.List<int[]> |
subsetsUpToSize(int collectionSize,
int n)
Enumerates all the subsets of indexes up to size 'n' for a collection of items of size
'collectionSize'.
|
static <K> java.lang.String |
toString(IntHashMap<K> histogram)
Return the full string representation of a IntHashMap
|
public static <T> T poll(java.util.Collection<T> collection)
public static java.util.List<int[]> subsetsUpToSize(int collectionSize,
int n)
collectionSize - n - public static void main(java.lang.String[] args)
public static <T> java.util.Collection<T> reservoirSampling(java.util.Collection<T> someCollection,
int sampleSize)
someCollection - sampleSize - public static <K> java.lang.String toString(IntHashMap<K> histogram)
histogram - public static <K,V> boolean addToMap(java.util.Map<K,java.util.List<V>> map,
K key,
V value)
map - key - value -