Example usage for com.google.common.collect Streams stream

List of usage examples for com.google.common.collect Streams stream

Introduction

In this page you can find the example usage for com.google.common.collect Streams stream.

Prototype

public static DoubleStream stream(OptionalDouble optional) 

Source Link

Document

If a value is present in optional , returns a stream containing only that element, otherwise returns an empty stream.

Usage

From source file:com.google.devtools.build.lib.query2.NamedThreadSafeOutputFormatterCallback.java

public static <T> String callbackNames(Iterable<NamedThreadSafeOutputFormatterCallback<T>> callbacks) {
    return Streams.stream(callbacks).map(NamedThreadSafeOutputFormatterCallback::getName)
            .collect(joining(", "));
}

From source file:com.linecorp.armeria.server.docs.ServiceSpecification.java

/**
 * Merges the specified {@link ServiceSpecification}s into one.
 *//*from w w  w.  ja  v  a  2 s  .c o m*/
public static ServiceSpecification merge(Iterable<ServiceSpecification> specs) {
    return new ServiceSpecification(
            Streams.stream(specs).flatMap(s -> s.services().values().stream())::iterator,
            Streams.stream(specs).flatMap(s -> s.classes().values().stream())::iterator);
}

From source file:com.google.devtools.build.lib.rules.java.JavaStrictCompilationArgsProvider.java

public static JavaStrictCompilationArgsProvider merge(Collection<JavaStrictCompilationArgsProvider> providers) {
    Collection<JavaCompilationArgsProvider> javaCompilationArgsProviders = Streams.stream(providers)
            .map(x -> x.getJavaCompilationArgsProvider()).collect(Collectors.toList());
    return new JavaStrictCompilationArgsProvider(
            JavaCompilationArgsProvider.merge(javaCompilationArgsProviders));
}

From source file:ec.tss.tsproviders.db.DbSeries.java

@Nonnull
public static DbSeries findById(@Nonnull Iterable<DbSeries> iterable, @Nonnull DbSetId id)
        throws NoSuchElementException {
    return Streams.stream(iterable).filter(o -> (o != null) ? id.equals(o.getId()) : false).findFirst()
            .orElseThrow(NoSuchElementException::new);
}

From source file:com.facebook.buck.rules.coercer.IntConcatenatingCoercer.java

@Nullable
@Override
public Object concat(Iterable<Object> elements) {
    return Streams.stream(elements).mapToInt(Integer.class::cast).sum();
}

From source file:ec.tstoolkit.utilities.Trees.java

@Nonnull
public static <T> Stream<T> breadthFirstStream(@Nonnull T root,
        @Nonnull Function<? super T, ? extends Stream<? extends T>> children) {
    return Streams.stream(breadthFirstIterable(root, children));
}

From source file:ec.tss.tsproviders.db.DbSeries.java

@Nonnull
public static List<DbSeries> filterByAncestor(@Nonnull Iterable<DbSeries> iterable, @Nonnull DbSetId ancestor) {
    return Streams.stream(iterable).filter(o -> (o != null) ? isDescendant(ancestor, o.getId()) : false)
            .collect(Collectors.toList());
}

From source file:com.facebook.presto.sql.planner.iterative.RuleStore.java

public Stream<Rule> getCandidates(PlanNode planNode) {
    return Streams.stream(ancestors(planNode.getClass())).flatMap(clazz -> rulesByClass.get(clazz).stream());
}

From source file:com.google.devtools.build.lib.query2.CqueryThreadsafeCallback.java

public static String callbackNames(Iterable<CqueryThreadsafeCallback> callbacks) {
    return Streams.stream(callbacks).map(CqueryThreadsafeCallback::getName).collect(joining(", "));
}

From source file:ec.tstoolkit.utilities.Trees.java

@Nonnull
public static <T> Stream<T> depthFirstStream(@Nonnull T root,
        @Nonnull Function<? super T, ? extends Stream<? extends T>> children) {
    return Streams.stream(depthFirstIterable(root, children));
}