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

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

Best Java code snippets using java.util.stream.Stream.iterator (Showing top 20 results out of 5,823)

Refine searchRefine arrow

  • Iterator.hasNext
  • Iterator.next
  • Stream.map
  • Stream.filter
origin: prestodb/presto

  private String columnDefinitions(List<DataTypeTest.Input<?>> inputs)
  {
    List<String> columnTypeDefinitions = inputs.stream()
        .map(DataTypeTest.Input::getInsertType)
        .collect(toList());
    Stream<String> columnDefinitions = range(0, columnTypeDefinitions.size())
        .mapToObj(i -> format("col_%d %s", i, columnTypeDefinitions.get(i)));
    return Joiner.on(",\n").join(columnDefinitions.iterator());
  }
}
origin: SonarSource/sonarqube

@Override
public Iterable<InputFile> filter(Iterable<InputFile> target) {
 return () -> StreamSupport.stream(target.spliterator(), false)
  .filter(this::apply)
  .iterator();
}
origin: SonarSource/sonarqube

private static void dropColumns(StringBuilder sql, String columnPrefix, String... columnNames) {
 Iterator<String> columnNamesIterator = Arrays.stream(columnNames).iterator();
 while (columnNamesIterator.hasNext()) {
  sql.append(columnPrefix);
  sql.append(columnNamesIterator.next());
  if (columnNamesIterator.hasNext()) {
   sql.append(", ");
  }
 }
}
origin: jooby-project/jooby

private void files(Path dir, Throwing.Consumer<Path> consumer) throws Exception {
 try (Stream<Path> stream = Files.walk(dir)) {
  Iterator<Path> files = stream.filter(Files::isRegularFile)
    .filter(it -> it.toString().endsWith(".svg"))
    .sorted()
    .iterator();
  while (files.hasNext()) {
   consumer.accept(files.next());
  }
 }
}
origin: prestodb/presto

private Iterator<InternalHiveSplit> createInternalHiveSplitIterator(Path path, FileSystem fileSystem, InternalHiveSplitFactory splitFactory, boolean splittable)
{
  return Streams.stream(new HiveFileIterator(path, fileSystem, directoryLister, namenodeStats, recursiveDirWalkerEnabled ? RECURSE : IGNORED))
      .map(status -> splitFactory.createInternalHiveSplit(status, splittable))
      .filter(Optional::isPresent)
      .map(Optional::get)
      .iterator();
}
origin: lettuce-io/lettuce-core

private static List<Integer> readSlots(List<String> slotStrings) {
  List<Integer> slots = new ArrayList<>();
  for (String slotString : slotStrings) {
    if (slotString.startsWith(TOKEN_SLOT_IN_TRANSITION)) {
      // not interesting
      continue;
    }
    if (slotString.contains("-")) {
      // slot range
      Iterator<String> it = DASH_PATTERN.splitAsStream(slotString).iterator();
      int from = Integer.parseInt(it.next());
      int to = Integer.parseInt(it.next());
      for (int slot = from; slot <= to; slot++) {
        slots.add(slot);
      }
      continue;
    }
    slots.add(Integer.parseInt(slotString));
  }
  return Collections.unmodifiableList(slots);
}
origin: apache/storm

public void send(Map<Integer, NodeInfo> taskToNode, Map<NodeInfo, IConnection> connections) {
  HashMap<NodeInfo, Stream<TaskMessage>> bundleMapByDestination = groupBundleByDestination(taskToNode);
  for (Map.Entry<NodeInfo, Stream<TaskMessage>> entry : bundleMapByDestination.entrySet()) {
    NodeInfo node = entry.getKey();
    IConnection conn = connections.get(node);
    if (conn != null) {
      Iterator<TaskMessage> iter = entry.getValue().iterator();
      if (iter.hasNext()) {
        conn.send(iter);
      }
    } else {
      LOG.warn("Connection not available for hostPort {}", node);
    }
  }
}
origin: jooby-project/jooby

count += compile(pipeline, files.stream().filter(styles).iterator(), MediaType.css, css,
  shouldProcess, count, total);
List<File> result = new ArrayList<>(css.getResult());
count += compile(pipeline, files.stream().filter(scripts).iterator(), MediaType.js, js,
  shouldProcess, count, total);
result.addAll(js.getResult());
origin: stanfordnlp/CoreNLP

/**
 * Joins each elem in the {@link Stream} with the given glue.
 * For example, given a list of {@code Integers}, you can create
 * a comma-separated list by calling {@code join(numbers, ", ")}.
 *
 * @see StringUtils#join(Iterable, String)
 */
public static <X> String join(Stream<X> l, String glue) {
 StringBuilder sb = new StringBuilder();
 boolean first = true;
 Iterator<X> iter = l.iterator();
 while (iter.hasNext()) {
  if ( ! first) {
   sb.append(glue);
  } else {
   first = false;
  }
  sb.append(iter.next());
 }
 return sb.toString();
}
origin: graphhopper/graphhopper

MultiCriteriaLabelSetting stationRouter = new MultiCriteriaLabelSetting(accessEgressGraphExplorer, flagEncoder, reverse, maxWalkDistancePerLeg, false, false, false, maxVisitedNodesForRequest, new ArrayList<>());
stationRouter.setBetaWalkTime(betaWalkTime);
Iterator<Label> stationIterator = stationRouter.calcLabels(destNode, startNode, initialTime, blockedRouteTypes).iterator();
List<Label> stationLabels = new ArrayList<>();
while (stationIterator.hasNext()) {
  Label label = stationIterator.next();
  if (label.adjNode == startNode) {
    stationLabels.add(label);
  smallestStationLabelWeight = Long.MAX_VALUE;
Iterator<Label> iterator = router.calcLabels(startNode, destNode, initialTime, blockedRouteTypes).iterator();
Map<Label, Label> originalSolutions = new HashMap<>();
          highestWeightForDominationTest = router.weight(discoveredSolutions.get(discoveredSolutions.size()-1));
        } else {
          highestWeightForDominationTest = discoveredSolutions.stream().filter(s -> !s.impossible && (ignoreTransfers || s.nTransfers <= 1)).mapToLong(router::weight).min().orElse(Long.MAX_VALUE);
    .map(originalSolutions::get)
    .map(l -> new TripFromLabel(gtfsStorage, realtimeFeed).getTransitions(arriveBy, flagEncoder, graphExplorer, l)).collect(Collectors.toList());
List<List<Label.Transition>> paths = pathsToStations.stream().map(p -> {
  if (arriveBy) {
    List<Label.Transition> pp = new ArrayList<>(p.subList(1, p.size()));
origin: MovingBlocks/Terasology

@SafeVarargs
@Override
public final Iterable<EntityRef> getEntitiesWith(Class<? extends Component>... componentClasses) {
  return () -> entityStore.keySet().stream()
      //Keep entities which have all of the required components
      .filter(id -> Arrays.stream(componentClasses)
          .allMatch(component -> componentStore.get(id, component) != null))
      .map(id -> getEntity(id))
      .iterator();
}
origin: reactor/reactor-core

@SuppressWarnings("unchecked")
void assertInnerSubscriberBefore(FluxZip.ZipCoordinator c) {
  FluxZip.ZipInner s = (FluxZip.ZipInner) c.inners()
                       .iterator()
                       .next();
  assertThat(s.scan(Scannable.Attr.TERMINATED)).isFalse();
  assertThat(s.scan(Scannable.Attr.PREFETCH)).isEqualTo(123);
  assertThat(s.scan(Scannable.Attr.BUFFERED)).isEqualTo(0);
  assertThat(s.scan(Scannable.Attr.CANCELLED)).isFalse();
}
origin: prestodb/presto

static String formatSortItems(List<SortItem> sortItems, Optional<List<Expression>> parameters)
{
  return Joiner.on(", ").join(sortItems.stream()
      .map(sortItemFormatterFunction(parameters))
      .iterator());
}
origin: spotbugs/spotbugs

public JrtfsCodeBaseIterator() {
  try {
    iterator = Files.walk(root).filter(p -> isClassFile(p)).iterator();
  } catch (IOException e) {
    e.printStackTrace();
  }
}
origin: apache/flink

  public Stream<String> searchAllLogs(Pattern pattern, Function<Matcher, String> matchProcessor) throws IOException {
    final List<String> matches = new ArrayList<>(2);

    try (Stream<Path> logFilesStream = Files.list(log)) {
      final Iterator<Path> logFiles = logFilesStream.iterator();
      while (logFiles.hasNext()) {
        final Path logFile = logFiles.next();
        if (!logFile.getFileName().toString().endsWith(".log")) {
          // ignore logs for previous runs that have a number suffix
          continue;
        }
        try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(logFile.toFile()), StandardCharsets.UTF_8))) {
          String line;
          while ((line = br.readLine()) != null) {
            Matcher matcher = pattern.matcher(line);
            if (matcher.matches()) {
              matches.add(matchProcessor.apply(matcher));
            }
          }
        }
      }
    }
    return matches.stream();
  }
}
origin: graphhopper/graphhopper

private Stream<TransferWithTime> getType0TransferWithTimes(GTFSFeed gtfsFeed) {
  return gtfsFeed.transfers.entrySet()
      .parallelStream()
      .filter(e -> e.getValue().transfer_type == 0)
      .map(e -> {
        PointList points = new PointList(2, false);
        final int fromnode = gtfsStorage.getStationNodes().get(e.getValue().from_stop_id);
        Iterator<Label> iterator = router.calcLabels(fromnode, tonode, Instant.ofEpochMilli(0), 0).iterator();
        Label solution = null;
        while (iterator.hasNext()) {
          Label label = iterator.next();
          if (tonode == label.adjNode) {
            solution = label;
origin: prestodb/presto

private Iterator<LocatedFileStatus> statusFromObjects(List<S3ObjectSummary> objects)
{
  // NOTE: for encrypted objects, S3ObjectSummary.size() used below is NOT correct,
  // however, to get the correct size we'd need to make an additional request to get
  // user metadata, and in this case it doesn't matter.
  return objects.stream()
      .filter(object -> !object.getKey().endsWith(PATH_SEPARATOR))
      .map(object -> new FileStatus(
          object.getSize(),
          false,
          1,
          BLOCK_SIZE.toBytes(),
          object.getLastModified().getTime(),
          qualifiedPath(new Path(PATH_SEPARATOR + object.getKey()))))
      .map(this::createLocatedFileStatus)
      .iterator();
}
origin: reactor/reactor-core

@SuppressWarnings("unchecked")
void assertInnerSubscriber(FluxZip.ZipCoordinator c) {
  FluxZip.ZipInner s = (FluxZip.ZipInner) c.inners()
                       .iterator()
                       .next();
  assertThat(s.scan(Scannable.Attr.TERMINATED)).isFalse();
  assertThat(s.scan(Scannable.Attr.PREFETCH)).isEqualTo(123);
  assertThat(c.inners()).hasSize(3);
  assertThat(s.scan(Scannable.Attr.CANCELLED)).isTrue();
}
origin: prestodb/presto

  private String joinExpressions(List<Expression> expressions)
  {
    return Joiner.on(", ").join(expressions.stream()
        .map((e) -> process(e, null))
        .iterator());
  }
}
origin: apache/incubator-druid

   .range(1, splits.size() - 3)
   .mapToObj(dataSourceDelimiterOrder -> DELIMITER_JOINER.join(splits.subList(0, dataSourceDelimiterOrder)))
   .filter(dataSource -> dataSource.length() != probableDataSource.length())
   .flatMap(dataSource -> iteratePossibleParsingsWithDataSource(dataSource, segmentId).stream())
   .iterator();
 return Iterables.concat(probableParsings, otherPossibleParsings);
} else {
   })
   .flatMap(List::stream)
   .iterator();
java.util.streamStreamiterator

Popular methods of Stream

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

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 WebStorm
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