Class FastRandomCollection<T>
java.lang.Object
com.fastasyncworldedit.core.util.collection.RandomCollection<T>
com.fastasyncworldedit.core.util.collection.FastRandomCollection<T>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Optional<RandomCollection<T>>
create
(Map<T, Double> weights, SimpleRandom random) Create a new FastRandomCollection if the given values and weights match the criteria.next
(int x, int y, int z) Methods inherited from class com.fastasyncworldedit.core.util.collection.RandomCollection
getRandom, of, setRandom
-
Method Details
-
create
Create a new FastRandomCollection if the given values and weights match the criteria. The criteria may change at any point, so this method isn't guaranteed to return a non-emptyOptional
in any case.- Type Parameters:
T
- the value type.- Parameters:
weights
- the weight of the values.random
- the random generator to use for this collection.- Returns:
- an
Optional
containing the new collection if it could be created,Optional.empty()
otherwise. - See Also:
-
next
- Specified by:
next
in classRandomCollection<T>
-