Interface IntPredicate

All Superinterfaces:
IntPredicate, Predicate<Integer>
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 IntPredicate extends Predicate<Integer>, IntPredicate
A type-specific Predicate; provides methods to test a primitive type both as object and as primitive.

Except for the boolean case, this interface extends both a parameterized Predicate and a type-specific JDK predicate (e.g., IntPredicate). For types missing a type-specific JDK predicate (e.g., short or float), we extend the predicate associated with the smallest primitive type that can represent the current type (e.g., int or double, respectively).

Since:
8.5.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default IntPredicate
    Returns a composed type-specific predicate that represents a short-circuiting logical AND of this type-specific predicate and another.
    default IntPredicate
    Returns a composed type-specific predicate that represents a short-circuiting logical AND of this type-specific predicate and another.
    and(Predicate<? super Integer> other)
    Deprecated.
    Please use the corresponding type-specific method instead.
    default IntPredicate
     
    default IntPredicate
    Returns a composed type-specific predicate that represents a short-circuiting logical OR of this type-specific predicate and another.
    default IntPredicate
    Returns a composed type-specific predicate that represents a short-circuiting logical OR of this type-specific predicate and another.
    or(Predicate<? super Integer> other)
    Deprecated.
    Please use the corresponding type-specific method instead.
    default boolean
    Deprecated.
    Please use the corresponding type-specific method instead.

    Methods inherited from interface java.util.function.IntPredicate

    test
  • Method Details

    • test

      @Deprecated default boolean test(Integer t)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      test in interface Predicate<Integer>
    • and

      default IntPredicate and(IntPredicate other)
      Returns a composed type-specific predicate that represents a short-circuiting logical AND of this type-specific predicate and another.
      Specified by:
      and in interface IntPredicate
      Parameters:
      other - a predicate that will be logically-ANDed with this predicate.
      Returns:
      a composed predicate that represents the short-circuiting logical AND of this predicate and the other predicate.
      See Also:
      API Notes:
      Implementing classes should generally override this method and keep the default implementation of the other overloads, which will delegate to this method (after proper conversions).
    • and

      default IntPredicate and(IntPredicate other)
      Returns a composed type-specific predicate that represents a short-circuiting logical AND of this type-specific predicate and another.

      WARNING: Overriding this method is almost always a mistake, as this overload only exists to disambiguate. Instead, override the and() overload that uses the JDK's primitive predicate type (e.g. IntPredicate).

      If Java supported final default methods, this would be one, but sadly it does not.

      If you checked and are overriding the version with java.util.function.XPredicate, and you still see this warning, then your IDE is incorrectly conflating this method with the proper method to override, and you can safely ignore this message.

      Parameters:
      other - a predicate that will be logically-ANDed with this predicate.
      Returns:
      a composed predicate that represents the short-circuiting logical AND of this predicate and the other predicate.
      See Also:
    • and

      @Deprecated default Predicate<Integer> and(Predicate<? super Integer> other)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      and in interface Predicate<Integer>
    • negate

      default IntPredicate negate()
      Specified by:
      negate in interface IntPredicate
      Specified by:
      negate in interface Predicate<Integer>
    • or

      default IntPredicate or(IntPredicate other)
      Returns a composed type-specific predicate that represents a short-circuiting logical OR of this type-specific predicate and another.
      Specified by:
      or in interface IntPredicate
      Parameters:
      other - a predicate that will be logically-ORed with this predicate.
      Returns:
      a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate.
      See Also:
      API Notes:
      Implementing classes should generally override this method and keep the default implementation of the other overloads, which will delegate to this method (after proper conversions).
    • or

      default IntPredicate or(IntPredicate other)
      Returns a composed type-specific predicate that represents a short-circuiting logical OR of this type-specific predicate and another.

      WARNING: Overriding this method is almost always a mistake, as this overload only exists to disambiguate. Instead, override the or() overload that uses the JDK's primitive predicate type (e.g. IntPredicate).

      If Java supported final default methods, this would be one, but sadly it does not.

      If you checked and are overriding the version with java.util.function.XPredicate, and you still see this warning, then your IDE is incorrectly conflating this method with the proper method to override, and you can safely ignore this message.

      Parameters:
      other - a predicate that will be logically-ORed with this predicate.
      Returns:
      a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate.
      See Also:
    • or

      @Deprecated default Predicate<Integer> or(Predicate<? super Integer> other)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      or in interface Predicate<Integer>