CollectionUtil and ListUtil
CollectionUtil
Located at dev.anvilcraft.lib.v2.util.CollectionUtil, provides collection operations:
allMatch(Collection<T>, Predicate<T>)– matches all elementsanyMatch(Collection<T>, Predicate<T>)– matches any elementnewMultimap(M, Collection<V>, Function<V,K>)– creates a Guava MultimapnewLinkedList(int)– creates aLinkedList(ignores the parameter, for convenience)get(SequencedCollection<T>, int)– safely retrieves by index, returnsnullif out of bounds
ListUtil
Located at dev.anvilcraft.lib.v2.util.ListUtil:
safelyGet(List<T>, int)– returnsOptional<T>, handling empty lists or out-of-bounds accesscycle(List<T>, int)– cyclically shifts elements, returns a new listcreateWithValues(int, IntFunction<T>)– builds a list of the specified sizecast(List<T>, Class<R>)– filters and casts to a subtype listequals(List<T>, List<U>, BiPredicate<T,U>)– compares two lists using a custom comparator