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:org.apache.twill.discovery.DefaultServiceDiscovered.java

DefaultServiceDiscovered(String name) {
    this.name = name;
    this.discoverables = new AtomicReference<Set<Discoverable>>(ImmutableSet.<Discoverable>of());
    this.listenerCallers = Lists.newLinkedList();
    this.callerLock = new ReentrantReadWriteLock();
}

From source file:voldemort.server.rebalance.RebalancerState.java

public String toJsonString() {
    List<Map<String, Object>> maps = Lists.newLinkedList();

    for (RebalanceTaskInfo rebalanceTaskInfo : stealInfoMap.values())
        maps.add(rebalanceTaskInfo.asMap());

    StringWriter stringWriter = new StringWriter();
    new JsonWriter(stringWriter).write(maps);
    stringWriter.flush();/*from w  w  w  . j  av  a  2s.  c o  m*/

    return stringWriter.toString();
}

From source file:com.chadekin.jadys.commons.expression.impl.SqlExpressionFactory.java

private SqlExpressionFactory() {
    items = Lists.newLinkedList();
    initHandlers(this.expressionHandler);
}

From source file:org.nll.hbase.ui.util.HbaseUtil.java

public static List<HbaseSchema> getTableSchema(HConnection connection) throws IOException {
    HTableDescriptor[] descriptors = connection.listTables();
    List<HbaseSchema> hbaseSchemas = Lists.newLinkedList();
    for (HTableDescriptor descriptor : descriptors) {
        HbaseSchema hbaseSchema = new HbaseSchema();
        hbaseSchema.setTableName(descriptor.getNameAsString());
        List<String> familes = Lists.newLinkedList();
        Set<byte[]> keys = descriptor.getFamiliesKeys();
        for (byte[] key : keys) {
            familes.add(Bytes.toString(key));
        }/*from   w w  w  .ja  va  2  s. c  om*/
        hbaseSchema.setFamilies(familes);
        hbaseSchemas.add(hbaseSchema);
    }
    return hbaseSchemas;
}

From source file:com.isotrol.impe3.palette.sitemap.SimpleListingComponent.java

@Renderer
public SitemapRenderer sitemap(final RenderContext context) {
    final List<URLEntry> entries = Lists.newLinkedList();
    if (page != null) {
        Route r = context.getRoute();//from   ww w.ja  v a  2s .co m
        r = r.toDevice(context.getPortal().getDevice());
        for (Content c : page) {
            PageKey pk = PageKey.content(c.getContentKey());
            URI u = context.getAbsoluteURI(r.toPage(pk));
            entries.add(URLEntry.of(u));
        }
    }
    return SitemapRenderers.set(entries);
}

From source file:org.kitesdk.data.spi.filesystem.MultiLevelIterator.java

public MultiLevelIterator(int depth) {
    Preconditions.checkArgument(depth > 0, "Depth must be > 0");
    this.depth = depth;
    this.current = Lists.newLinkedList();
    this.iterators = Lists.newLinkedList();
    this.initialized = false;
}

From source file:org.eclipse.sirius.diagram.ui.business.internal.dialect.SetBestHeightHeaderCommand.java

/**
 * Overridden to refresh the sequence layout.
 * //ww w .  jav  a 2s .  co  m
 * {@inheritDoc}
 */
@Override
protected void doExecute() {
    LinkedList<HeaderData> headerDatas = Lists.newLinkedList();
    if (diagram.getElement() instanceof DDiagram) {
        DDiagram dDiagram = (DDiagram) diagram.getElement();
        for (final IDiagramTypeDescriptor diagramTypeDescriptor : DiagramTypeDescriptorRegistry.getInstance()
                .getAllDiagramTypeDescriptors()) {
            if (diagramTypeDescriptor.getDiagramDescriptionProvider()
                    .handles(dDiagram.getDescription().eClass().getEPackage())) {
                headerDatas = diagramTypeDescriptor.getDiagramDescriptionProvider().getHeaderData(dDiagram);
                break;
            }
        }
        int nbLines = getNbLinesNeeded(headerDatas);
        dDiagram.setHeaderHeight(nbLines);
    }
}

From source file:org.sonar.duplications.detector.suffixtree.Search.java

/**
 * Depth-first search (DFS)./*w w w  .j a  v  a 2 s .  c  o m*/
 */
private void dfs() {
    LinkedList<Node> stack = Lists.newLinkedList();
    stack.add(tree.getRootNode());
    while (!stack.isEmpty()) {
        Node node = stack.removeLast();
        node.startSize = list.size();
        if (node.getEdges().isEmpty()) {
            // leaf
            list.add(node.depth);
            node.endSize = list.size();
        } else {
            if (!node.equals(tree.getRootNode())) {
                // inner node = not leaf and not root
                innerNodes.add(node);
            }
            for (Edge edge : node.getEdges()) {
                Node endNode = edge.getEndNode();
                endNode.depth = node.depth + edge.getSpan() + 1;
                stack.addLast(endNode);
            }
        }
    }
    // At this point all inner nodes are ordered by the time of entering, so we visit them from last to first
    ListIterator<Node> iterator = innerNodes.listIterator(innerNodes.size());
    while (iterator.hasPrevious()) {
        Node node = iterator.previous();
        int max = -1;
        for (Edge edge : node.getEdges()) {
            max = Math.max(edge.getEndNode().endSize, max);
        }
        node.endSize = max;
    }
}

From source file:com.epam.reportportal.utils.queue.BatchExecutor.java

/**
 * Executes all hold operations and clears batch queue
 * /*from  w w w.  ja v a2 s.  c  om*/
 * @throws IOException
 */
public void executeAndClear() throws IOException {
    Queue<Parameter<P, R>> flushed = batch;
    batch = Lists.newLinkedList();
    if (!flushed.isEmpty())
        executeBatch(flushed);
}

From source file:exec.validate_evaluation.queryhistory.QueryHistoryIo.java

public Collection<List<Usage>> readQueryHistories(String zip) {

    Directory dir = new Directory(this.dir);
    try (IReadingArchive ra = dir.getReadingArchive(zip)) {

        Type type = new TypeToken<List<Usage>>() {
        }.getType();//w  w w .  jav  a2s  . c o  m

        List<List<Usage>> us = Lists.newLinkedList();
        while (ra.hasNext()) {
            us.add(ra.getNext(type));
        }
        return us;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}