Interface ToShortFunction<T>

Type Parameters:
T - the input type
All Superinterfaces:
ToPrimitiveFunction<T>, TypedFunction<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ToShortFunction<T> extends ToPrimitiveFunction<T>
A short function.
  • Method Details

    • cast

      static <T> ToShortFunction<T> cast()
      Assumes the object value is directly castable to a short. Equivalent to x -> (short)x.
      Type Parameters:
      T - the value type
      Returns:
      the short function
    • map

      static <T, R> ToShortFunction<T> map(Function<? super T,? extends R> f, ToShortFunction<? super R> g)
      Creates the function composition g ∘ f.

      Equivalent to x -> g.applyAsShort(f.apply(x)).

      Type Parameters:
      T - the input type
      R - the intermediate type
      Parameters:
      f - the inner function
      g - the outer function
      Returns:
      the short function
    • applyAsShort

      short applyAsShort(T value)
      Applies this function to the given argument.
      Parameters:
      value - the function argument
      Returns:
      the function result
    • returnType

      default ShortType returnType()
      Description copied from interface: TypedFunction
      This function's return type.
      Specified by:
      returnType in interface ToPrimitiveFunction<T>
      Specified by:
      returnType in interface TypedFunction<T>
      Returns:
      the type
    • walk

      default <R> R walk(ToPrimitiveFunction.Visitor<T,R> visitor)
      Specified by:
      walk in interface ToPrimitiveFunction<T>