Class FunctionHelper

java.lang.Object
net.darkhax.bookshelf.common.api.util.FunctionHelper

public class FunctionHelper extends Object
  • Constructor Details

    • FunctionHelper

      public FunctionHelper()
  • Method Details

    • test

      public static <T> boolean test(Optional<T> input, Predicate<T> test)
      Tests an optional value. If the value is empty or the test fails it will return false.
      Type Parameters:
      T - The type of value to test.
      Parameters:
      input - The input value to test.
      test - The test to perform.
      Returns:
      If the test was successful.
    • unpack

      public static <T> T unpack(com.mojang.datafixers.util.Either<T,T> either)
      Unpacks an Either into its value using the first possible match.
      Type Parameters:
      T - The type of value held by the Either.
      Parameters:
      either - The Either to resolve.
      Returns:
      The first value that was unpacked.