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

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

Best Java code snippets using java.util.stream.Stream.flatMap (Showing top 20 results out of 21,258)

Refine searchRefine arrow

  • Stream.collect
  • Stream.map
  • List.stream
  • Collectors.toList
  • Stream.filter
origin: spring-projects/spring-framework

private List<MediaType> getMediaTypes(List<View> views) {
  return views.stream()
      .flatMap(view -> view.getSupportedMediaTypes().stream())
      .collect(Collectors.toList());
}
origin: prestodb/presto

  public static <K, V> Map<K, V> mergeMaps(Stream<Map<K, V>> mapStream, BinaryOperator<V> merger)
  {
    return mapStream
        .map(Map::entrySet)
        .flatMap(Collection::stream)
        .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, merger));
  }
}
origin: neo4j/neo4j

private static Stream<Method> methodsStream( List<Class<?>> interfaces )
{
  return interfaces.stream().map( Class::getMethods ).flatMap( Arrays::stream );
}
origin: prestodb/presto

@Override
public List<Symbol> getOutputSymbols()
{
  return ImmutableList.<Symbol>builder()
      .addAll(groupingSets.stream()
          .flatMap(Collection::stream)
          .collect(toSet()))
      .addAll(aggregationArguments)
      .add(groupIdSymbol)
      .build();
}
origin: apache/incubator-druid

Stream<SegmentWithState> getAppendingSegments(Collection<String> sequenceNames)
{
 synchronized (segments) {
  return sequenceNames
    .stream()
    .map(segments::get)
    .filter(Objects::nonNull)
    .flatMap(segmentsForSequence -> segmentsForSequence.intervalToSegmentStates.values().stream())
    .map(segmentsOfInterval -> segmentsOfInterval.appendingSegment)
    .filter(Objects::nonNull);
 }
}
origin: apache/incubator-druid

public Collection<Server> getAllServers()
{
 return ((Collection<List<Server>>) hostSelector.getAllBrokers().values()).stream()
                                      .flatMap(Collection::stream)
                                      .collect(Collectors.toList());
}
origin: neo4j/neo4j

public Set<File> idFiles()
{
  return Arrays.stream( DatabaseFile.values() )
         .filter( DatabaseFile::hasIdFile )
        .flatMap( value -> Streams.ofOptional( idFile( value ) ) )
         .collect( Collectors.toSet() );
}
origin: apache/flink

/**
 * Gets a stream of values from a collection of range resources.
 */
public static LongStream rangeValues(Collection<Protos.Resource> resources) {
  checkNotNull(resources);
  return resources.stream()
    .filter(Protos.Resource::hasRanges)
    .flatMap(r -> r.getRanges().getRangeList().stream())
    .flatMapToLong(Utils::rangeValues);
}
origin: prestodb/presto

  @Override
  public void validate(PlanNode plan, Session session, Metadata metadata, SqlParser sqlParser, TypeProvider types, WarningCollector warningCollector)
  {
    searchFrom(plan)
        .where(AggregationNode.class::isInstance)
        .<AggregationNode>findAll()
        .stream()
        .flatMap(node -> node.getAggregations().values().stream())
        .filter(aggregation -> aggregation.getCall().getFilter().isPresent())
        .forEach(ignored -> {
          throw new IllegalStateException("Generated plan contains unimplemented filtered aggregations");
        });
  }
}
origin: spring-projects/spring-framework

@Override
protected void applyCookies() {
  getCookies().values().stream().flatMap(Collection::stream)
      .map(cookie -> new DefaultCookie(cookie.getName(), cookie.getValue()))
      .forEach(this.request::addCookie);
}
origin: spring-projects/spring-framework

/**
 * Create a new {@link MockMultipartHttpServletRequest} based on the
 * supplied {@code ServletContext} and the {@code MockMultipartFiles}
 * added to this builder.
 */
@Override
protected final MockHttpServletRequest createServletRequest(ServletContext servletContext) {
  MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(servletContext);
  this.files.stream().forEach(request::addFile);
  this.parts.values().stream().flatMap(Collection::stream).forEach(request::addPart);
  if (!this.parts.isEmpty()) {
    new StandardMultipartHttpServletRequest(request)
        .getMultiFileMap().values().stream().flatMap(Collection::stream)
        .forEach(request::addFile);
  }
  return request;
}
origin: neo4j/neo4j

private Stream<CompilationMessage> findDuplicates( Collection<Element> visitedProcedures )
{
  return indexByName( visitedProcedures ).filter( index -> index.getValue().size() > 1 )
      .flatMap( this::asErrors );
}
origin: prestodb/presto

@Override
public List<Expression> getExpressions()
{
  return sets.stream()
      .flatMap(List::stream)
      .collect(Collectors.toList());
}
origin: prestodb/presto

public static List<? extends SqlFunction> extractFunctions(Collection<Class<?>> classes)
{
  return classes.stream()
      .map(FunctionExtractor::extractFunctions)
      .flatMap(Collection::stream)
      .collect(toImmutableList());
}
origin: prestodb/presto

public MultiJoinNode(LinkedHashSet<PlanNode> sources, Expression filter, List<Symbol> outputSymbols)
{
  requireNonNull(sources, "sources is null");
  checkArgument(sources.size() > 1, "sources size is <= 1");
  requireNonNull(filter, "filter is null");
  requireNonNull(outputSymbols, "outputSymbols is null");
  this.sources = sources;
  this.filter = filter;
  this.outputSymbols = ImmutableList.copyOf(outputSymbols);
  List<Symbol> inputSymbols = sources.stream().flatMap(source -> source.getOutputSymbols().stream()).collect(toImmutableList());
  checkArgument(inputSymbols.containsAll(outputSymbols), "inputs do not contain all output symbols");
}
origin: jenkinsci/jenkins

/**
 * Returns initial {@link Method} as well as all matching ones found in interfaces.
 * This allows to introspect metadata for a method which is both declared in parent class and in implemented
 * interface(s). <code>interfaces</code> typically is obtained by {@link ClassUtils#getAllInterfacesAsSet}
 */
Collection<Method> getMethodAndInterfaceDeclarations(Method method, Collection<Class> interfaces) {
  final List<Method> methods = new ArrayList<>();
  methods.add(method);
  // we search for matching method by iteration and comparison vs getMethod to avoid repeated NoSuchMethodException
  // being thrown, while interface typically only define a few set of methods to check.
  interfaces.stream()
      .map(Class::getMethods)
      .flatMap(Arrays::stream)
      .filter(m -> m.getName().equals(method.getName()) && Arrays.equals(m.getParameterTypes(), method.getParameterTypes()))
      .findFirst()
      .ifPresent(methods::add);
  return methods;
}
origin: Graylog2/graylog2-server

@Override
public void upgrade() {
  this.indexSetService.findAll()
    .stream()
    .map(mongoIndexSetFactory::create)
    .flatMap(indexSet -> getReopenedIndices(indexSet).stream())
    .map(indexName -> { LOG.debug("Marking index {} to be reopened using alias.", indexName); return indexName; })
    .forEach(indices::markIndexReopened);
}
origin: apache/incubator-druid

private List<DataSegment> getAvailableDataSegments()
{
 return metadataSegmentManager.getDataSources()
                .stream()
                .flatMap(source -> source.getSegments().stream())
                .collect(Collectors.toList());
}
origin: spring-projects/spring-framework

@Override
protected void applyCookies() {
  getCookies().values().stream().flatMap(Collection::stream)
      .map(cookie -> new HttpCookie(cookie.getName(), cookie.getValue()))
      .forEach(this.jettyRequest::cookie);
}
origin: eclipse-vertx/vert.x

public synchronized List<T> handlers() {
 return handlerMap.values().stream()
  .flatMap(handlers -> handlers.list.stream())
  .map(holder -> holder.handler)
  .collect(Collectors.toList());
}
java.util.streamStreamflatMap

Javadoc

Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element. Each mapped stream is java.util.stream.BaseStream#close() after its contents have been placed into this stream. (If a mapped stream is nullan empty stream is used, instead.)

This is an intermediate operation.

Popular methods of Stream

  • collect
  • map
  • filter
  • forEach
  • findFirst
  • of
  • anyMatch
  • sorted
  • toArray
  • findAny
  • count
  • allMatch
  • count,
  • 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 Vim plugins
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