src/share/classes/java/util/function/DoubleUnaryOperator.java

Print this page
rev 7047 : 8004015: Additional static and instance utils for functional interfaces.
Reviewed-by: briangoetz


  25 package java.util.function;
  26 
  27 /**
  28  * An operation on a {@code double} operand yielding a {@code double}
  29  * result. This is the primitive type specialization of {@link UnaryOperator}
  30  * for {@code double}.
  31  *
  32  * @see UnaryOperator
  33  * @since 1.8
  34  */
  35 @FunctionalInterface
  36 public interface DoubleUnaryOperator {
  37 
  38     /**
  39      * Returns the {@code double} result of the operation upon the
  40      * {@code double} operand.
  41      *
  42      * @param operand the operand value
  43      * @return the operation result value
  44      */
  45     public double applyAsDouble(double operand);









  46 }


  25 package java.util.function;
  26 
  27 /**
  28  * An operation on a {@code double} operand yielding a {@code double}
  29  * result. This is the primitive type specialization of {@link UnaryOperator}
  30  * for {@code double}.
  31  *
  32  * @see UnaryOperator
  33  * @since 1.8
  34  */
  35 @FunctionalInterface
  36 public interface DoubleUnaryOperator {
  37 
  38     /**
  39      * Returns the {@code double} result of the operation upon the
  40      * {@code double} operand.
  41      *
  42      * @param operand the operand value
  43      * @return the operation result value
  44      */
  45     double applyAsDouble(double operand);
  46 
  47     /**
  48      * Returns a unary operator that provides its input value as the result.
  49      *
  50      * @return a unary operator that provides its input value as the result
  51      */
  52     static DoubleUnaryOperator identity() {
  53         return t -> t;
  54     }
  55 }