java.lang.Object
org.opencastproject.util.data.functions.Misc

public final class Misc extends Object
Various functions not directly bound to any type.
  • Method Details

    • chuck

      public static <A> A chuck(Throwable t)
      Throw a checked exception like a RuntimeException removing any needs to declare a throws clause. This technique has been described by James Iry at http://james-iry.blogspot.de/2010/08/on-removing-java-checked-exceptions-by.html
    • chuck

      public static <A extends Throwable, B> Function<A,B> chuck()
      chuck(Throwable) as a function.
    • cast

      public static <A, B> B cast(A v, Class<B> to)
      Cast from A to B with special treatment of the Number classes.
    • widen

      public static <A> List<A> widen(List<? extends A> xs)
      Widening cast.
    • widen

      public static <A> Optional<A> widen(Optional<? extends A> xs)
      Widening cast.
    • ifThen

      public static <A> Function<A,A> ifThen(A predicate, A b)