public class WeightedSet<T>
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
WeightedSet() |
Modifier and Type | Method and Description |
---|---|
WeightedSet<T> |
add(double weight,
T element) |
WeightedSet<T> |
clear() |
T |
get() |
T |
get(java.util.Random random) |
void |
getAndDo(int count,
java.util.function.Consumer<T> consumer) |
void |
getAndDo(java.util.Random random,
int count,
java.util.function.Consumer<T> consumer) |
double |
getChance(T element) |
java.lang.String |
getChanceString(T element,
int decimalPlaces) |
double |
getWeight(T element) |
boolean |
isEffectivelyEmpty() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
static <T> WeightedSet<T> |
newWeightedSet(java.lang.Object... contents) |
int |
size() |
java.util.Spliterator<T> |
spliterator() |
java.util.stream.Stream<T> |
stream() |
double |
weight() |
public static <T> WeightedSet<T> newWeightedSet(java.lang.Object... contents)
public WeightedSet<T> add(double weight, T element)
public WeightedSet<T> clear()
public T get()
public T get(java.util.Random random)
public void getAndDo(int count, java.util.function.Consumer<T> consumer)
public void getAndDo(java.util.Random random, int count, java.util.function.Consumer<T> consumer)
public double getWeight(T element)
public double getChance(T element)
public java.lang.String getChanceString(T element, int decimalPlaces)
public boolean isEffectivelyEmpty()
public boolean isEmpty()
public int size()
public double weight()
public java.util.stream.Stream<T> stream()
public java.util.Iterator<T> iterator()
public java.util.Spliterator<T> spliterator()