Example usage for com.google.common.collect Lists newLinkedList

List of usage examples for com.google.common.collect Lists newLinkedList

Introduction

In this page you can find the example usage for com.google.common.collect Lists newLinkedList.

Prototype

@GwtCompatible(serializable = true)
public static <E> LinkedList<E> newLinkedList(Iterable<? extends E> elements) 

Source Link

Document

Creates a mutable LinkedList instance containing the given elements; a very thin shortcut for creating an empty list then calling Iterables#addAll .

Usage

From source file:org.thiesen.collections.list.impl.MutableLinkedList.java

public static <T> MutableLinkedList<T> of(final T... elements) {
    return new MutableLinkedList<T>(Lists.newLinkedList(Arrays.asList(elements)));
}

From source file:org.gradle.api.plugins.buildcomparison.outcome.internal.CompositeBuildOutcomeAssociator.java

public CompositeBuildOutcomeAssociator(Iterable<BuildOutcomeAssociator> associators) {
    this.associators = Lists.newLinkedList(associators);
}

From source file:com.flowlogix.jeedao.primefaces.support.SortData.java

public SortData(Collection<SortMeta> sm) {
    sortMeta = Lists.newLinkedList(sm);
}

From source file:org.gradle.api.plugins.antlr.internal.AntlrSpecFactory.java

public AntlrSpec create(AntlrTask antlrTask, Set<File> grammarFiles, SourceDirectorySet sourceDirectorySet) {
    List<String> arguments = Lists.newLinkedList(antlrTask.getArguments());

    if (antlrTask.isTrace() && !arguments.contains("-trace")) {
        arguments.add("-trace");
    }//from www  .  j  ava  2  s .  c  o  m
    if (antlrTask.isTraceLexer() && !arguments.contains("-traceLexer")) {
        arguments.add("-traceLexer");
    }
    if (antlrTask.isTraceParser() && !arguments.contains("-traceParser")) {
        arguments.add("-traceParser");
    }
    if (antlrTask.isTraceTreeWalker() && !arguments.contains("-traceTreeWalker")) {
        arguments.add("-traceTreeWalker");
    }

    return new AntlrSpec(arguments, grammarFiles, sourceDirectorySet.getSrcDirs(),
            antlrTask.getOutputDirectory(), antlrTask.getMaxHeapSize());
}

From source file:com.github.yongchristophertang.database.guice.provider.AnnotationClientFactory.java

AnnotationClientFactory(A[] annos) {
    this.annos = annos;
    clients = Lists.newLinkedList(
            Lists.newArrayList(annos).stream().map(this::createClient).collect(Collectors.toList()));
}

From source file:com.lastcalc.engines.FixedOrderParserPickerFactory.java

public FixedOrderParserPickerFactory(final Parser... parsers) {
    this.parsers = Lists.newLinkedList(Lists.newArrayList(parsers));
}

From source file:org.caleydo.view.tourguide.api.score.Scores.java

/**
 * flattens the given scores, i.e. flat composites to a big flat set
 *
 * @param scores/*  w w  w . j  av a 2s  .  co  m*/
 * @return
 */
public static Set<IScore> flatten(Iterable<IScore> scores) {
    Set<IScore> result = new HashSet<>();
    Deque<IScore> queue = Lists.newLinkedList(scores);
    while (!queue.isEmpty()) {
        IScore s = queue.pollFirst();
        if (!result.add(s))
            continue;
        if (s instanceof MultiScore)
            queue.addAll(((MultiScore) s).getChildren());
        else if (s instanceof IDecoratedScore) {
            queue.add(((IDecoratedScore) s).getUnderlying());
        }
    }
    return result;

}

From source file:cloudify.widget.common.CollectionUtils.java

public static <T> T firstBy(Iterable<? extends T> collection, final Predicate<T> predicate) {

    LinkedList<T> output = Lists.newLinkedList(collection);
    CollectionUtils.filter(output, new org.apache.commons.collections.Predicate() {
        @Override/*from  www.  j av a  2 s  .  co  m*/
        public boolean evaluate(Object object) {
            return predicate.evaluate((T) object);
        }
    });

    return CollectionUtils.first(output);
}

From source file:com.google.jstestdriver.coverage.CoverageActionDecorator.java

public List<Action> process(List<Action> actions) {
    List<Action> processed = Lists.newLinkedList(actions);
    processed.add(reporter);//from  ww  w .j  a va2s  .  co m
    return processed;
}

From source file:com.insightml.utils.types.collections.IList.java

public IList(final Iterable<E> list) {
    this.list = Lists.newLinkedList(list);
}