Class CollectionUtils

java.lang.Object
io.github.syst3ms.skriptparser.util.CollectionUtils

public class CollectionUtils extends Object
Utility functions for Collection objects
  • Constructor Details

    • CollectionUtils

      public CollectionUtils()
  • Method Details

    • arrayOf

      @SafeVarargs public static <T> T[] arrayOf(T... values)
    • getRandom

      public static <T> T getRandom(T[] array)
    • reverseArray

      public static <T> T[] reverseArray(T[] array)
    • contains

      @SafeVarargs public static <T> boolean contains(T[] array, T... contained)
    • ordinalConditionalIndexOf

      public static <T> int ordinalConditionalIndexOf(T[] array, int n, Predicate<T> condition)
      Find the index of an item, where a given predicate applies, from a given class in an array, skipping over all these items as long as the amount of items skipped is smaller than a given amount.
      Parameters:
      array - the array
      n - the ordinal you want to get the index from
      condition - the condition
      Returns:
      the index, -1 if no index was found