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

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

Introduction

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

Prototype

@GwtCompatible(serializable = true)
public static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements) 

Source Link

Document

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

Usage

From source file:com.spectralogic.ds3client.models.bulk.WriteOptimization.java

public static String valuesString() {
    final ArrayList<WriteOptimization> list = Lists.newArrayList(WriteOptimization.values());
    return Joiner.on(", ").join(Lists.transform(list, new Function<WriteOptimization, String>() {
        @Override//w ww  . ja v a 2  s  .co  m
        public String apply(@Nonnull final WriteOptimization input) {
            return input.toString().toLowerCase();
        }
    }));
}

From source file:org.obiba.mica.dataset.search.rest.harmonization.ContingencyUtils.java

public static List<String> getTermsHeaders(DatasetVariable variable, Mica.DatasetVariableContingenciesDto dto) {
    List<String> dtoTerms = Lists.newArrayList(dto.getContingenciesList().stream()
            .flatMap(c -> c.getAggregationsList().stream()).map(a -> a.getTerm()).collect(toSet()));
    List<String> terms = variable.getCategories() != null
            ? variable.getCategories().stream().map(c -> c.getName()).collect(toList())
            : Lists.newArrayList();/*from w  w  w.j  a va2 s .co m*/
    terms.addAll(Sets.difference(Sets.newHashSet(dtoTerms), Sets.newHashSet(terms)));

    return terms;
}

From source file:com.spectralogic.ds3client.models.bulk.Priority.java

public static String valuesString() {
    final ArrayList<Priority> list = Lists.newArrayList(Priority.values());
    return Joiner.on(", ").join(Lists.transform(list, new Function<Priority, String>() {
        @Override//w  w w .  ja va2  s .c  o  m
        public String apply(@Nonnull final Priority input) {
            return input.toString().toLowerCase();
        }
    }));
}

From source file:org.apache.jackrabbit.oak.OakAssert.java

public static void assertSequence(Iterable<Tree> trees, String... names) {
    List<String> expected = Lists.newArrayList(names);
    List<String> actual = Lists.newArrayList();
    for (Tree t : trees) {
        actual.add(t.getName());/*from   w  w  w .  j  a va 2 s . c o m*/
    }
    assertEquals(expected.toString(), actual.toString());
}

From source file:com.rptools.name.NameAttribute.java

public static List<NameAttribute> asList() {
    return Lists.newArrayList(NameAttribute.values());
}

From source file:com.sk89q.worldedit.util.command.argument.ArgumentUtils.java

public static List<String> getMatchingSuggestions(Collection<String> items, String s) {
    if (s.isEmpty()) {
        return Lists.newArrayList(items);
    }/*from  ww  w. j a v  a  2 s .c  o  m*/
    List<String> suggestions = Lists.newArrayList();
    for (String item : items) {
        if (item.toLowerCase().startsWith(s)) {
            suggestions.add(item);
        }
    }
    return suggestions;
}

From source file:org.zoumbox.mh_dla_notifier.troll.EquipementType.java

public static EquipementType fromType(String type) {
    List<String> types = Lists.newArrayList(Splitter.on(" ").trimResults().split(type));
    String searchedType = types.get(0);
    return valueOf(searchedType);
}

From source file:kr.debop4j.data.hibernate.forTesting.MappingInfo.java

/**
 * From mapping info.//from   ww w  . j  ava2  s . co m
 *
 * @param packages the packages
 * @return the mapping info
 */
public static MappingInfo from(Package... packages) {
    return new MappingInfo(Lists.newArrayList(packages));
}

From source file:org.dllearner.algorithms.qtl.operations.lgg.LGGGeneratorImpl.java

public static void main(String[] args) throws Exception {
    LGGGenerator<String> lggGen = new LGGGeneratorImpl<String>();

    List<QueryTree<String>> trees = new ArrayList<QueryTree<String>>();
    QueryTree<String> tree;
    Model model;//from  www.  j a v  a 2s .  c  o m
    ConciseBoundedDescriptionGenerator cbdGenerator = new ConciseBoundedDescriptionGeneratorImpl(
            SparqlEndpoint.getEndpointDBpedia(), "cache");
    cbdGenerator.setRecursionDepth(1);
    QueryTreeCache treeCache = new QueryTreeCache();
    List<String> resources = Lists.newArrayList("http://dbpedia.org/resource/Leipzig");//, "http://dbpedia.org/resource/Dresden");
    for (String resource : resources) {
        try {
            System.out.println(resource);
            model = cbdGenerator.getConciseBoundedDescription(resource);
            tree = treeCache.getQueryTree(resource, model);
            System.out.println(tree.getStringRepresentation());
            trees.add(tree);
            trees.add(tree);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    lggGen.getLGG(trees);
}