Package net.mcreator.util
Class ListUtils
java.lang.Object
net.mcreator.util.ListUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncartesianProduct(Map<K, ? extends List<V>> input) Generates the full Cartesian product of a set of keys and their possible values.static <T> TgetRandomItem(List<T> list) static <T> TgetRandomItem(Random random, List<T> list) static <T> TgetRandomItem(Random random, T[] list) static <T> TgetRandomItem(T[] list) static <T> Collection<T> intersect(Collection<T> a, Collection<T> b) static <T> List<T> merge(Collection<T>... collections) static <T> Set<T> mergeNoDuplicates(Collection<T>... collections) static <T> void
-
Constructor Details
-
ListUtils
public ListUtils()
-
-
Method Details
-
merge
-
mergeNoDuplicates
-
intersect
-
rearrange
-
getRandomItem
public static <T> T getRandomItem(T[] list) -
getRandomItem
-
getRandomItem
-
getRandomItem
-
cartesianProduct
Generates the full Cartesian product of a set of keys and their possible values.Example: If the map contains:
A -> [1, 2] B -> [true, false]
The output will be a list containing:
{A=1, B=true} {A=1, B=false} {A=2, B=true} {A=2, B=false}- Type Parameters:
K- key typeV- value type- Parameters:
input- map of keys and their possible values; order of keys defines output order- Returns:
- all combinations as a list of maps (each map is a unique combination)
-