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() 

Source Link

Document

Creates a mutable, empty LinkedList instance (for Java 6 and earlier).

Usage

From source file:com.textocat.textokit.commons.util.ManifestUtils.java

/**
 * @return manifests that contains a main attribute with the specified key
 *//*  w w w . j  a  v  a2s .com*/
public static List<Manifest> searchByAttributeKey(String key) {
    try {
        Enumeration<URL> resEnum = Thread.currentThread().getContextClassLoader()
                .getResources(JarFile.MANIFEST_NAME);
        List<Manifest> resultList = Lists.newLinkedList();
        while (resEnum.hasMoreElements()) {
            URL url = resEnum.nextElement();
            try (InputStream is = url.openStream()) {
                Manifest manifest = new Manifest(is);
                Attributes mainAttribs = manifest.getMainAttributes();
                if (mainAttribs.getValue(key) != null) {
                    resultList.add(manifest);
                }
            }
        }
        return resultList;
    } catch (IOException e) {
        throw new IllegalStateException("manifest lookup error", e);
    }
}

From source file:interactivespaces.activity.ActivityStateTransitioner.java

/**
 * Create the queue of transitions in a syntactically pleasing way.
 *
 * @param transitions//from   w  w  w . j  av  a  2s  .  c o m
 *          the transitions to be queued
 *
 * @return the queue of transitions
 */
public static Queue<ActivityStateTransition> transitions(ActivityStateTransition... transitions) {
    Queue<ActivityStateTransition> result = Lists.newLinkedList();

    if (transitions != null) {
        for (ActivityStateTransition transition : transitions) {
            result.add(transition);
        }
    }

    return result;
}

From source file:fr.univnantes.lina.uima.tkregex.AutomatonFactory.java

public static Automaton createMNAutomaton(Automaton automaton, int m, int n) {
    List<Automaton> toConcat = Lists.newLinkedList();
    toConcat.add(createNAutomaton(automaton, m));
    for (int i = 0; i < (n - m); i++)
        toConcat.add(createZeroOneAutomaton(automaton));
    return createConcatenation(toConcat);
}

From source file:classes.SPClass.java

public SPClass() {
    spArgumentNames = Lists.newLinkedList();
}

From source file:exec.examples.IoHelper.java

public static List<Context> read(String zipFile) {
    LinkedList<Context> res = Lists.newLinkedList();
    try {/*from   w  w w. j ava2  s.  c  om*/
        IReadingArchive ra = new ReadingArchive(new File(zipFile));
        while (ra.hasNext()) {
            res.add(ra.getNext(Context.class));
        }
        ra.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return res;
}

From source file:org.killbill.billing.invoice.usage.UsageUtils.java

public static List<TieredBlock> getConsumableInArrearTieredBlocks(final Usage usage, final String unitType) {

    Preconditions.checkArgument(/*w w w.  j ava  2s  . c om*/
            usage.getBillingMode() == BillingMode.IN_ARREAR && usage.getUsageType() == UsageType.CONSUMABLE);
    Preconditions.checkArgument(usage.getTiers().length > 0);

    final List<TieredBlock> result = Lists.newLinkedList();
    for (Tier tier : usage.getTiers()) {
        for (TieredBlock tierBlock : tier.getTieredBlocks()) {
            if (tierBlock.getUnit().getName().equals(unitType)) {
                result.add(tierBlock);
            }
        }
    }
    return result;
}

From source file:org.jetbrains.jet.plugin.JetPluginUtil.java

@NotNull
private static LinkedList<String> computeTypeFullNameList(JetType type) {
    if (type instanceof DeferredType) {
        type = ((DeferredType) type).getActualType();
    }//  w  w  w .  jav  a  2 s . c o  m
    DeclarationDescriptor declarationDescriptor = type.getConstructor().getDeclarationDescriptor();

    LinkedList<String> fullName = Lists.newLinkedList();
    while (declarationDescriptor != null && !(declarationDescriptor instanceof ModuleDescriptor)) {
        fullName.addFirst(declarationDescriptor.getName().getName());
        declarationDescriptor = declarationDescriptor.getContainingDeclaration();
    }
    assert fullName.size() > 0;
    if (JavaDescriptorResolver.JAVA_ROOT.getName().equals(fullName.getFirst())) {
        fullName.removeFirst();
    }
    return fullName;
}

From source file:us.physion.ovation.ui.importer.ImageImporter.java

public static Observable<Measurement> importImagesEpoch(EpochContainer container, Iterable<File> files) {
    List<FileMetadata> metadata = Lists.newArrayList();
    for (File f : files) {
        metadata.add(new FileMetadata(f));
    }/*from  www  . j a  v  a  2s  . c o  m*/

    List<Measurement> result = Lists.newLinkedList();
    for (FileMetadata fileMetadata : metadata) {

        Epoch epoch = container.insertEpoch(fileMetadata.getStart(), fileMetadata.getEnd(false), null,
                fileMetadata.getEpochProtocolParameters(), fileMetadata.getDeviceParameters());

        for (Map<String, Object> m : fileMetadata.getMeasurements()) {
            epoch.insertMeasurement(String.format("Image %d", (Integer) m.get(FileMetadata.IMAGE_NUMBER)),
                    Sets.<String>newHashSet(), Sets.newHashSet((Set<String>) m.get(FileMetadata.DEVICE_NAMES)),
                    (URL) m.get(FileMetadata.IMAGE_URL), (String) m.get(FileMetadata.MIME_TYPE));
        }
    }

    return Observable.from(result);
}

From source file:net.roddrim.number5.tools.collect.FluentList.java

public static <E> FluentList<E> ofNewLinkedList() {
    return of(Lists.newLinkedList());
}

From source file:org.geogig.osm.internal.history.Way.java

public Way() {
    super();
    this.nodes = Lists.newLinkedList();
}