congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
IntPredicate
Code IndexAdd Tabnine to your IDE (free)

How to use
IntPredicate
in
java.util.function

Best Java code snippets using java.util.function.IntPredicate (Showing top 20 results out of 900)

Refine searchRefine arrow

  • ConcurrentModificationException
  • Objects
origin: speedment/speedment

@Override
public boolean anyMatch(IntPredicate predicate) {
  requireNonNull(predicate);
  return predicate.test(element);
}
origin: spring-projects/spring-framework

@Override
public int indexOf(IntPredicate predicate, int fromIndex) {
  Assert.notNull(predicate, "IntPredicate must not be null");
  if (fromIndex < 0) {
    fromIndex = 0;
  }
  else if (fromIndex >= this.byteBuf.writerIndex()) {
    return -1;
  }
  int length = this.byteBuf.writerIndex() - fromIndex;
  return this.byteBuf.forEachByte(fromIndex, length, predicate.negate()::test);
}
origin: neo4j/neo4j

  @Override
  public boolean test( int item )
  {
    return filter.test( item );
  }
};
origin: stackoverflow.com

 IntPredicate predicate=i -> i==5;

if(ints.length>0 && predicate.test(ints[0]))
  predicate=predicate.negate();
boolean result = IntStream.of(ints).anyMatch(predicate);
origin: stackoverflow.com

 package com.company;

import rx.Observable;

import java.util.function.IntPredicate;
import java.util.stream.IntStream;

public class Main {

  public static void main(String[] args) {

    final IntPredicate[] p={(x)->true};
    IntStream primesStream=IntStream.iterate(2,n->n+1).filter(i -> p[0].test(i)).peek(i->p[0]=p[0].and(v->v%i!=0)   );

    Observable primes = Observable.from(()->primesStream.iterator());

    primes.take(10).forEach((x) -> System.out.println(x.toString()));


  }

}
origin: net.sf.saxon/Saxon-HE

@Override
public IntPredicate getMatcher(NodeVectorTree tree) {
  switch (operator) {
    case Token.UNION:
      return nodetest1.getMatcher(tree).or(nodetest2.getMatcher(tree));
    case Token.INTERSECT:
      return nodetest1.getMatcher(tree).and(nodetest2.getMatcher(tree));
    case Token.EXCEPT:
      return new IntExceptPredicate(nodetest1.getMatcher(tree), nodetest2.getMatcher(tree));
    default:
      throw new IllegalArgumentException("Unknown operator in Combined Node Test");
  }
}
origin: prestodb/presto

  /**
   * Evaluates whether the provided table bucket number passes the bucket predicate.
   * A bucket predicate can be present in two cases:
   * <ul>
   * <li>Filter on "$bucket" column. e.g. {@code "$bucket" between 0 and 100}
   * <li>Single-value equality filter on all bucket columns. e.g. for a table with two bucketing columns,
   *     {@code bucketCol1 = 'a' AND bucketCol2 = 123}
   * </ul>
   */
  public boolean isTableBucketEnabled(int tableBucketNumber)
  {
    return bucketFilter.test(tableBucketNumber);
  }
}
origin: stackoverflow.com

IntPredicate dividesBy3 = i -> i % 3 == 0;
   IntPredicate dividesBy5 = i -> i % 5 == 0;
   IntPredicate doesntDivide = dividesBy3.negate().and(dividesBy5.negate());
   IntStream.rangeClosed(0, 100).forEach(i -> {
     StringBuffer bfr = new StringBuffer();
     if (dividesBy3.test(i)) bfr.append("Fizz");
     if (dividesBy5.test(i)) bfr.append("Buzz");
     if (doesntDivide.test(i)) bfr.append(i);
     System.out.println(bfr);
 });
origin: stackoverflow.com

 public static StreamEx<Integer> sieve(StreamEx<Integer> input, IntPredicate isPrime) {
  return input.headTail((head, tail) -> isPrime.test(head) 
      ? sieve(tail, isPrime.and(n -> n % head != 0)).prepend(head)
      : sieve(tail, isPrime));
}

sieve(StreamEx.iterate(2, x -> x+1), i -> true).limit(1000).forEach(System.out::println);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

@Override
public IntPredicate getMatcher(NodeVectorTree tree) {
  switch (operator) {
    case Token.UNION:
      return nodetest1.getMatcher(tree).or(nodetest2.getMatcher(tree));
    case Token.INTERSECT:
      return nodetest1.getMatcher(tree).and(nodetest2.getMatcher(tree));
    case Token.EXCEPT:
      return new IntExceptPredicate(nodetest1.getMatcher(tree), nodetest2.getMatcher(tree));
    default:
      throw new IllegalArgumentException("Unknown operator in Combined Node Test");
  }
}
origin: speedment/speedment

@Override
public boolean noneMatch(IntPredicate predicate) {
  requireNonNull(predicate);
  return !predicate.test(element);
}
origin: spring-projects/spring-framework

@Override
public int lastIndexOf(IntPredicate predicate, int fromIndex) {
  Assert.notNull(predicate, "IntPredicate must not be null");
  int i = Math.min(fromIndex, this.writePosition - 1);
  for (; i >= 0; i--) {
    byte b = this.byteBuffer.get(i);
    if (predicate.test(b)) {
      return i;
    }
  }
  return -1;
}
origin: spring-projects/spring-framework

@Override
public int lastIndexOf(IntPredicate predicate, int fromIndex) {
  Assert.notNull(predicate, "IntPredicate must not be null");
  if (fromIndex < 0) {
    return -1;
  }
  fromIndex = Math.min(fromIndex, this.byteBuf.writerIndex() - 1);
  return this.byteBuf.forEachByteDesc(0, fromIndex + 1, predicate.negate()::test);
}
origin: speedment/speedment

@Override
public boolean allMatch(IntPredicate predicate) {
  requireNonNull(predicate);
  return predicate.test(element);
}
origin: wildfly/wildfly

  private boolean skip(int c) {
    return predicate.test(c);
  }
}
origin: org.springframework/spring-core

@Override
public int lastIndexOf(IntPredicate predicate, int fromIndex) {
  Assert.notNull(predicate, "IntPredicate must not be null");
  if (fromIndex < 0) {
    return -1;
  }
  fromIndex = Math.min(fromIndex, this.byteBuf.writerIndex() - 1);
  return this.byteBuf.forEachByteDesc(0, fromIndex + 1, predicate.negate()::test);
}
origin: speedment/speedment

/**
 * Returns, if this stream is ordered, a stream consisting of the longest
 * prefix of elements taken from this stream that match the given predicate.
 *
 * @param predicate - a non-interfering, stateless predicate to apply to
 * elements to determine the longest prefix of elements.
 * @return the new stream
 */
public IntStream takeWhile(IntPredicate predicate) {
  requireNonNull(predicate);
  if (predicate.test(element)) {
    return this;
  } else {
    return empty();
  }
}
origin: wildfly/wildfly

  private boolean skip(int c) {
    return predicate.test(c);
  }
};
origin: org.springframework/spring-core

@Override
public int indexOf(IntPredicate predicate, int fromIndex) {
  Assert.notNull(predicate, "IntPredicate must not be null");
  if (fromIndex < 0) {
    fromIndex = 0;
  }
  else if (fromIndex >= this.byteBuf.writerIndex()) {
    return -1;
  }
  int length = this.byteBuf.writerIndex() - fromIndex;
  return this.byteBuf.forEachByte(fromIndex, length, predicate.negate()::test);
}
origin: speedment/speedment

/**
 * Returns, if this stream is ordered, a stream consisting of the remaining
 * elements of this stream after dropping the longest prefix of elements
 * that match the given predicate. Otherwise returns, if this stream is
 * unordered, a stream consisting of the remaining elements of this stream
 * after dropping a subset of elements that match the given predicate.
 *
 * @param predicate - a non-interfering, stateless predicate to apply to
 * elements to determine the longest prefix of elements.
 *
 * @return new new stream
 */
public IntStream dropWhile(IntPredicate predicate) {
  requireNonNull(predicate);
  if (predicate.test(element)) {
    return empty();
  } else {
    return this;
  }
}
java.util.functionIntPredicate

Javadoc

Represents a predicate (boolean-valued function) of one int-valued argument. This is the int-consuming primitive type specialization of Predicate.

This is a functional interface whose functional method is #test(int).

Most used methods

  • test
  • negate
  • and
  • or

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • getSystemService (Context)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now