Example usage for com.google.common.collect Iterables concat

List of usage examples for com.google.common.collect Iterables concat

Introduction

In this page you can find the example usage for com.google.common.collect Iterables concat.

Prototype

public static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b,
        Iterable<? extends T> c) 

Source Link

Document

Combines three iterables into a single iterable.

Usage

From source file:org.carrot2.core.ProcessingComponentSuite.java

/**
 * Returns all components available in this suite, including data sources, algorithms
 * and any other types.//from ww  w . j a va2 s . c o m
 */
public List<ProcessingComponentDescriptor> getComponents() {
    return Lists.newArrayList(Iterables.concat(sources, algorithms, otherComponents));
}

From source file:com.facebook.buck.jvm.java.JavaLibraryDeps.java

@Value.Lazy
public ImmutableSortedSet<BuildRule> getDeps() {
    return resolve(Iterables.concat(getDepTargets(), getExportedDepTargets(),
            getDepsQuery().map(Query::getResolvedQuery).orElse(ImmutableSortedSet.of())));
}

From source file:uk.me.sa.cursus.app.ExportSeries.java

private void export(ScoresXMLFile scores) throws Exception {
    scores.to(new File("target" + File.separator + fileName + ".xml")); //$NON-NLS-1$ //$NON-NLS-2$

    XSLTHTMLGenerator gen = new XSLTHTMLGenerator(fileName + ".xml", fileName, //$NON-NLS-1$
            "../../../src/main/resources/eu/lp0/cursus", scores); //$NON-NLS-1$

    gen.setLongNames(true);//from  ww  w.  j  a  va2  s  .c  o  m
    gen.getStyleSheets().add("spka.css"); //$NON-NLS-1$
    gen.getStyleSheets().addAll(Arrays.asList(styleSheets));
    gen.getFlags().put("compact-race", "10"); //$NON-NLS-1$ //$NON-NLS-2$
    gen.getFlags().put("compact-event", "10"); //$NON-NLS-1$ //$NON-NLS-2$
    if (getClass().getName().contains("Top")) { //$NON-NLS-1$
        gen.getFlags().put("top-country", null); //$NON-NLS-1$
    }

    for (DataXMLClass class_ : scores.getData().getSeries().getClasses()) {
        if (class_.getName().equals("16\" Wheel")) { //$NON-NLS-1$
            gen.getClasses().put(class_.getName(), "16\""); //$NON-NLS-1$
        } else if (class_.getName().equals("Junior")) { //$NON-NLS-1$
            gen.getClasses().put(class_.getName(), class_.getName());
        }
    }

    for (Map.Entry<String, ByteSource> page : Iterables.concat(gen.getMenuPage().entrySet(),
            gen.getSimplePage().entrySet(), gen.getSplitPages().entrySet())) {
        page.getValue().copyTo(Files.asByteSink(new File("target" + File.separator + page.getKey()))); //$NON-NLS-1$
    }
}

From source file:io.prestosql.sql.analyzer.Analyzer.java

static void verifyNoAggregateWindowOrGroupingFunctions(FunctionRegistry functionRegistry, Expression predicate,
        String clause) {//from www.j av  a2  s .  c  om
    List<FunctionCall> aggregates = extractAggregateFunctions(ImmutableList.of(predicate), functionRegistry);

    List<FunctionCall> windowExpressions = extractWindowFunctions(ImmutableList.of(predicate));

    List<GroupingOperation> groupingOperations = extractExpressions(ImmutableList.of(predicate),
            GroupingOperation.class);

    List<Expression> found = ImmutableList
            .copyOf(Iterables.concat(aggregates, windowExpressions, groupingOperations));

    if (!found.isEmpty()) {
        throw new SemanticException(CANNOT_HAVE_AGGREGATIONS_WINDOWS_OR_GROUPING, predicate,
                "%s cannot contain aggregations, window functions or grouping operations: %s", clause, found);
    }
}

From source file:com.facebook.buck.jvm.java.JavaLibraryDeps.java

@Value.Lazy
public ImmutableSortedSet<BuildRule> getProvidedDeps() {
    return resolve(Iterables.concat(getProvidedDepTargets(), getExportedProvidedDepTargets(),
            getProvidedDepsQuery().map(Query::getResolvedQuery).orElse(ImmutableSortedSet.of())));
}

From source file:org.graylog2.periodical.ThroughputCalculator.java

@Override
public void doRun() {
    final SortedMap<String, ? extends Counting> counters = metricRegistry
            .getCounters(filterSingleMetric(GlobalMetricNames.OUTPUT_THROUGHPUT));
    // rinse and repeat for input throughput
    final SortedMap<String, ? extends Counting> inputCounters = metricRegistry
            .getCounters(filterSingleMetric(GlobalMetricNames.INPUT_THROUGHPUT));

    // StreamMetrics isn't accessible here, so we need to use a metrics filter instead.
    final SortedMap<String, ? extends Counting> streamMeters = metricRegistry.getMeters(new MetricFilter() {
        @Override//  w w w. j a  v  a2s. co  m
        public boolean matches(String name, Metric metric) {
            return name.matches("org\\.graylog2\\.plugin\\.streams\\.Stream\\..*?\\.incomingMessages");
        }
    });

    final Iterable<Map.Entry<String, ? extends Counting>> entries = Iterables.concat(counters.entrySet(),
            inputCounters.entrySet(), streamMeters.entrySet());

    // calculate rates
    for (Map.Entry<String, ? extends Counting> countingEntry : entries) {
        final Counting value = countingEntry.getValue();

        final String metricName = countingEntry.getKey();
        CounterSample counterSample = sampledCounters.get(metricName);
        if (counterSample == null) {
            counterSample = new CounterSample();
            sampledCounters.put(metricName, counterSample);
        }
        counterSample.updateAverage(value.getCount());
        final String rateName = name(metricName, GlobalMetricNames.RATE_SUFFIX);
        if (!metricRegistry.getMetrics().containsKey(rateName)) {
            try {
                log.debug("Registering derived, per-second metric {}", rateName);
                metricRegistry.register(rateName, new Gauge<Double>() {
                    @Override
                    public Double getValue() {
                        final CounterSample sample = sampledCounters.get(metricName);
                        return sample == null ? 0d : sample.getCurrentAverage();
                    }
                });
            } catch (IllegalArgumentException e) {
                log.warn(
                        "Could not register gauge {} despite checking before that it didn't exist. This should not happen.",
                        rateName);
            }
        }
    }
}

From source file:org.sonar.java.model.statement.AssertStatementTreeImpl.java

@Override
public Iterable<Tree> children() {
    return Iterables.concat(Lists.newArrayList(assertToken, condition),
            colonToken != null ? Lists.newArrayList(colonToken, detail) : Collections.<Tree>emptyList(),
            Collections.singletonList(semicolonToken));
}