Package it.unimi.dsi.fastutil.shorts
Interface ShortUnaryOperator
-
- All Superinterfaces:
java.util.function.Function<java.lang.Short,java.lang.Short>
,java.util.function.IntUnaryOperator
,java.util.function.UnaryOperator<java.lang.Short>
- 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 ShortUnaryOperator extends java.util.function.UnaryOperator<java.lang.Short>, java.util.function.IntUnaryOperator
A type-specificUnaryOperator
; provides methods operating both on objects and on primitives.- Since:
- 8.5.0
- See Also:
UnaryOperator
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description short
apply(short x)
Computes the operator on the given input.default java.lang.Short
apply(java.lang.Short x)
Deprecated.Please use the corresponding type-specific method instead.default int
applyAsInt(int x)
Deprecated.Please useapply(short)
.static ShortUnaryOperator
identity()
Returns aUnaryOperator
that always returns the input unmodified.static ShortUnaryOperator
negation()
Returns aUnaryOperator
that always returns the arithmetic negation of the input.
-
-
-
Method Detail
-
apply
short apply(short x)
Computes the operator on the given input.- Parameters:
x
- the input.- Returns:
- the output of the operator on the given input.
-
identity
static ShortUnaryOperator identity()
Returns aUnaryOperator
that always returns the input unmodified.- See Also:
UnaryOperator.identity()
-
negation
static ShortUnaryOperator negation()
Returns aUnaryOperator
that always returns the arithmetic negation of the input.- Implementation Notes:
- As with all negation, be wary of unexpected behavior near the minimum value of the data type.
For example, -
Integer.MIN_VALUE
will result inInteger.MIN_VALUE
(still negative), as the positive value ofInteger.MIN_VALUE
is too big forint
(it would be 1 greater thenInteger.MAX_VALUE
).
-
applyAsInt
@Deprecated default int applyAsInt(int x)
Deprecated.Please useapply(short)
.- Specified by:
applyAsInt
in interfacejava.util.function.IntUnaryOperator
- Throws:
java.lang.IllegalArgumentException
- If the given operands are not an element of the key domain.- Since:
- 8.5.0
- Implementation Specification:
- This default implementation delegates to
apply(short)
after narrowing down the argument to the actual key type, throwing an exception if the argument cannot be represented in the restricted domain. This is done for interoperability with the Java 8 function environment. The use of this method discouraged, as unexpected errors can occur.
-
apply
@Deprecated default java.lang.Short apply(java.lang.Short x)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
apply
in interfacejava.util.function.Function<java.lang.Short,java.lang.Short>
-
-