Tabnine Logo
Stream.count
Code IndexAdd Tabnine to your IDE (free)

How to use
count
method
in
java.util.stream.Stream

Best Java code snippets using java.util.stream.Stream.count (Showing top 20 results out of 10,269)

Refine searchRefine arrow

  • Stream.filter
  • List.stream
  • Set.stream
  • Test.<init>
  • Assert.assertEquals
origin: JanusGraph/janusgraph

public static void assertCount(long expected, Stream stream) {
  org.junit.Assert.assertEquals(expected, stream.count());
}
origin: prestodb/presto

private static int getNullFlagsCount(List<ArgumentProperty> argumentProperties)
{
  return (int) argumentProperties.stream()
      .filter(argumentProperty -> argumentProperty.getNullConvention() == USE_NULL_FLAG)
      .count();
}
origin: floragunncom/search-guard

public boolean impliesClusterPermissionPermission(String action) {
  return roles.stream()
      .filter(r->r.impliesClusterPermission(action)).count() > 0;
}

origin: goldmansachs/gs-collections

@Benchmark
public void serial_lazy_jdk()
{
  long evens = this.integersJDK.stream().filter(each -> each % 2 == 0).count();
  Assert.assertEquals(SIZE / 2, evens);
}
origin: kiegroup/optaplanner

public int missingSpeakerPreferredTimeslotTagCount() {
  if (timeslot == null) {
    return 0;
  }
  return (int) speakerList.stream().flatMap(speaker -> speaker.getPreferredTimeslotTagSet().stream())
      .filter(tag -> !timeslot.hasTag(tag)).count();
}
origin: AxonFramework/AxonFramework

@Test
public void testLoadNonExistent() {
  assertEquals(0L, testSubject.readEvents(randomUUID().toString()).asStream().count());
}
origin: goldmansachs/gs-collections

@Benchmark
public void parallel_lazy_jdk()
{
  long evens = this.integersJDK.parallelStream().filter(each -> each % 2 == 0).count();
  Assert.assertEquals(SIZE / 2, evens);
}
origin: spring-projects/spring-framework

@Test
public void streamIsEmptyForEmptyValues() {
  MutablePropertyValues pvs = new MutablePropertyValues();
  assertThat(pvs.stream(), notNullValue());
  assertThat(pvs.stream().count(), is(0L));
}
origin: OpenHFT/Chronicle-Queue

@Test
public void shouldNotRewindPastStartOfQueueWhenDisplayingHistory() {
  basicReader().historyRecords(Long.MAX_VALUE).execute();
  assertThat(capturedOutput.stream().
      filter(msg -> !msg.startsWith("0x")).count(), is(24L));
}
origin: prestodb/presto

private static boolean hasMixedDistinctAndNonDistincts(AggregationNode aggregation)
{
  long distincts = aggregation.getAggregations()
      .values().stream()
      .map(Aggregation::getCall)
      .filter(FunctionCall::isDistinct)
      .count();
  return distincts > 0 && distincts < aggregation.getAggregations().size();
}
origin: reactor/reactor-core

@Test
public void streamAlreadyConsumed() {
  AssertSubscriber<Integer> ts = AssertSubscriber.create();
  Stream<Integer> s = source.stream();
  s.count();
  Flux.fromStream(s)
    .subscribe(ts);
  ts.assertNoValues()
   .assertNotComplete()
   .assertError(IllegalStateException.class);
}
origin: prestodb/presto

@Test
public void testNonDeterministic()
{
  MaterializedResult materializedResult = computeActual("SELECT rand() FROM orders LIMIT 10");
  long distinctCount = materializedResult.getMaterializedRows().stream()
      .map(row -> row.getField(0))
      .distinct()
      .count();
  assertTrue(distinctCount >= 8, "rand() must produce different rows");
  materializedResult = computeActual("SELECT apply(1, x -> x + rand()) FROM orders LIMIT 10");
  distinctCount = materializedResult.getMaterializedRows().stream()
      .map(row -> row.getField(0))
      .distinct()
      .count();
  assertTrue(distinctCount >= 8, "rand() must produce different rows");
}
origin: goldmansachs/gs-collections

@Benchmark
public void serial_lazy_jdk()
{
  long evens = this.integersJDK.stream().filter(each -> each % 2 == 0).count();
  Assert.assertEquals(SIZE / 2, evens);
}
origin: prestodb/presto

private static int getBlockPositionCount(List<ArgumentProperty> argumentProperties)
{
  return (int) argumentProperties.stream()
      .filter(argumentProperty -> argumentProperty.getNullConvention() == BLOCK_AND_POSITION)
      .count();
}
origin: kiegroup/optaplanner

public int prevailingSpeakerUndesiredTimeslotTagCount() {
  if (timeslot == null) {
    return 0;
  }
  return (int) speakerList.stream().flatMap(speaker -> speaker.getUndesiredTimeslotTagSet().stream())
      .filter(tag -> timeslot.hasTag(tag)).count();
}
origin: JanusGraph/janusgraph

@Test
public void largeTest() throws Exception {
  final int numDoc = 30000;
  final String store = "vertex";
  initialize(store);
  for (int i = 1; i <= numDoc; i++) {
    add(store, "doc" + i, getRandomDocument(), true);
  }
  clopen();
  final long time = System.currentTimeMillis();
  Stream<String> result = tx.queryStream(new IndexQuery(store, And.of(PredicateCondition.of(WEIGHT, Cmp.GREATER_THAN_EQUAL, 0.2), PredicateCondition.of(WEIGHT, Cmp.LESS_THAN, 0.6), PredicateCondition.of(LOCATION, Geo.WITHIN, Geoshape.circle(48.5, 0.5, 1000.00)))));
  final long oldResultSize = result.count();
  System.out.println(oldResultSize + " vs " + (numDoc / 1000 * 2.4622623015));
  System.out.println("Query time on " + numDoc + " docs (ms): " + (System.currentTimeMillis() - time));
  result = tx.queryStream(new IndexQuery(store, And.of(PredicateCondition.of(WEIGHT, Cmp.GREATER_THAN_EQUAL, 0.2), PredicateCondition.of(WEIGHT, Cmp.LESS_THAN, 0.6), PredicateCondition.of(LOCATION, Geo.WITHIN, Geoshape.circle(48.5, 0.5, 1000.00))), numDoc / 1000));
  assertEquals(numDoc / 1000, result.count());
  result = tx.queryStream(new IndexQuery(store, And.of(PredicateCondition.of(WEIGHT, Cmp.GREATER_THAN_EQUAL, 0.2), PredicateCondition.of(WEIGHT, Cmp.LESS_THAN, 0.6), PredicateCondition.of(LOCATION, Geo.WITHIN, Geoshape.circle(48.5, 0.5, 1000.00))), numDoc / 1000 * 100));
  assertEquals(oldResultSize, result.count());
}
origin: SonarSource/sonarqube

private void checkAtLeastOneActionIsDefined(Set<String> actions) {
 long actionsDefined = actions.stream().filter(action -> !action.equals(COMMENT_KEY)).count();
 checkArgument(actionsDefined > 0, "At least one action must be provided");
}
origin: goldmansachs/gs-collections

@Benchmark
public void parallel_lazy_jdk()
{
  long evens = this.integersJDK.parallelStream().filter(each -> each % 2 == 0).count();
  Assert.assertEquals(SIZE / 2, evens);
}
origin: spring-projects/spring-framework

@Test
public void streamIsEmptyForEmptySources() {
  MutablePropertySources sources = new MutablePropertySources();
  assertThat(sources.stream(), notNullValue());
  assertThat(sources.stream().count(), is(0L));
}
origin: OpenHFT/Chronicle-Queue

@Test
public void shouldFilterByMultipleExclusionRegex() {
  basicReader().withExclusionRegex(".*bye$").withExclusionRegex(".*ell.*").execute();
  assertThat(capturedOutput.stream().filter(msg -> !msg.startsWith("0x")).count(), is(0L));
}
java.util.streamStreamcount

Popular methods of Stream

  • collect
  • map
  • filter
  • forEach
  • findFirst
  • of
  • anyMatch
  • flatMap
  • sorted
  • toArray
  • findAny
  • allMatch
  • findAny,
  • allMatch,
  • concat,
  • reduce,
  • mapToInt,
  • distinct,
  • empty,
  • noneMatch,
  • iterator

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • BoxLayout (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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