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.google.jstestdriver.AggregatingResponseStreamFactory.java

private List<ResponseStream> defaultStreams() {
    final List<ResponseStream> defaultStreams = Lists.newLinkedList();
    defaultStreams.add(new BrowserPanicResponseStream());
    return defaultStreams;
}

From source file:debug_create_page_for_free_text_answers.java

public static List<String> getListFor(String taskId) {
    if (answers.containsKey(taskId)) {
        return answers.get(taskId);
    }//from   ww  w.j ava 2s. co m
    List<String> l = Lists.newLinkedList();
    answers.put(taskId, l);
    return l;
}

From source file:org.gradle.internal.operations.DefaultBuildOperationQueue.java

DefaultBuildOperationQueue(ExecutorService executor, BuildOperationWorker<T> worker, String logLocation) {
    this.logLocation = logLocation;
    this.executor = MoreExecutors.listeningDecorator(executor);
    this.worker = worker;
    this.operations = Lists.newLinkedList();
}

From source file:org.eclipse.xtext.builder.resourceloader.SerialResourceLoader.java

@Override
public LoadOperation create(final ResourceSet parent, IProject project) {
    final Queue<URI> queue = Lists.newLinkedList();
    return new CheckedLoadOperation(new LoadOperation() {

        @Override/*from w ww .  j a  v  a  2  s .c om*/
        public LoadResult next() {
            URI uri = queue.poll();
            try {
                Resource resource = parent.getResource(uri, true);
                return new LoadResult(resource, uri);
            } catch (WrappedException e) {
                throw new LoadOperationException(uri, (Exception) e.getCause());
            }
        }

        @Override
        public boolean hasNext() {
            return !queue.isEmpty();
        }

        @Override
        public Collection<URI> cancel() {
            return queue;
        }

        @Override
        public void load(Collection<URI> uris) {
            queue.addAll(getSorter().sort(uris));
        }
    });
}

From source file:exec.validate_evaluation.categorized.MicroCommitIoExtension.java

public List<String> findZipsWith(ICoReTypeName type) {
    List<String> zips = Lists.newLinkedList();
    zipLoop: for (String zip : contents.keySet()) {
        for (MicroCommit mc : contents.get(zip)) {
            if (type.equals(mc.getType())) {
                zips.add(zip);//  ww  w . j a  v  a  2 s . c o  m
                continue zipLoop;
            }
        }
    }
    return zips;
}

From source file:org.apache.kylin.tool.metrics.systemcube.KylinTableCreator.java

public static TableDesc generateKylinTableForMetricsQueryCube(KylinConfig kylinConfig, SinkTool sinkTool) {
    List<Pair<String, String>> columns = Lists.newLinkedList();
    columns.addAll(HiveTableCreator.getHiveColumnsForMetricsQueryCube());
    columns.addAll(HiveTableCreator.getPartitionKVsForHiveTable());
    return generateKylinTable(sinkTool, kylinConfig.getKylinMetricsSubjectQueryCube(), columns);
}

From source file:org.des.tao.ide.editors.VariableEditor.java

public VariableEditor() {
    super();

    totalVariableCount = 0;
    backupVariableCount = 0;
    backupTableModel = Lists.newLinkedList();
}

From source file:com.ardor3d.extension.ui.text.parser.ForumLikeMarkupParser.java

@Override
public String parseStyleSpans(final String text, final List<StyleSpan> store) {
    final StringBuilder rVal = new StringBuilder("");
    int index = 0;
    TagStatus tagStatus = TagStatus.NONE;
    String currTagText = "";
    final LinkedList<StyleSpan> buildingSpans = Lists.newLinkedList();
    final StringTokenizer st = new StringTokenizer(text, "[]\\", true);
    String token;/*from w  w  w  .j av  a 2s  . com*/
    while (st.hasMoreTokens()) {
        token = st.nextToken();
        // escape char
        if (tagStatus == TagStatus.NONE && "\\".equals(token)) {
            if (st.hasMoreTokens()) {
                token = st.nextToken();
                if ("[".equals(token) || "]".equals(token)) {
                    rVal.append(token);
                    index++;
                    continue;
                } else {
                    rVal.append('\\');
                    rVal.append(token);
                    index += token.length() + 1;
                    continue;
                }
            } else {
                rVal.append('\\');
                index++;
                continue;
            }
        }

        // start token
        else if (tagStatus == TagStatus.NONE && "[".equals(token)) {
            tagStatus = TagStatus.START_TAG;
            continue;
        }

        else if (tagStatus == TagStatus.START_TAG) {
            currTagText = token;
            tagStatus = TagStatus.IN_TAG;
            continue;
        }

        // end token
        else if (tagStatus == TagStatus.IN_TAG && "]".equals(token)) {
            tagStatus = TagStatus.NONE;
            // interpret tag:
            // BOLD
            if ("b".equalsIgnoreCase(currTagText)) {
                // start a new bold span
                buildingSpans.add(new StyleSpan(StyleConstants.KEY_BOLD, Boolean.TRUE, index, 0));
            } else if ("/b".equalsIgnoreCase(currTagText)) {
                // find last BOLD entry and add length
                endSpan(StyleConstants.KEY_BOLD, store, index, buildingSpans);
            }

            // ITALICS
            else if ("i".equalsIgnoreCase(currTagText)) {
                // start a new italics span
                buildingSpans.add(new StyleSpan(StyleConstants.KEY_ITALICS, Boolean.TRUE, index, 0));
            } else if ("/i".equalsIgnoreCase(currTagText)) {
                // find last ITALICS entry and add length
                endSpan(StyleConstants.KEY_ITALICS, store, index, buildingSpans);
            }

            // COLOR
            else if (currTagText.toLowerCase().startsWith("c=")) {
                // start a new color span
                try {
                    // parse a color
                    final String c = currTagText.substring(2);
                    buildingSpans.add(
                            new StyleSpan(StyleConstants.KEY_COLOR, ColorRGBA.parseColor(c, null), index, 0));
                } catch (final Exception e) {
                    e.printStackTrace();
                }
            } else if ("/c".equalsIgnoreCase(currTagText)) {
                // find last BOLD entry and add length
                endSpan(StyleConstants.KEY_COLOR, store, index, buildingSpans);
            }

            // SIZE
            else if (currTagText.toLowerCase().startsWith("size=")) {
                // start a new size span
                try {
                    // parse a size
                    final int i = Integer.parseInt(currTagText.substring(5));
                    buildingSpans.add(new StyleSpan(StyleConstants.KEY_SIZE, i, index, 0));
                } catch (final Exception e) {
                    e.printStackTrace();
                }
            } else if ("/size".equalsIgnoreCase(currTagText)) {
                // find last SIZE entry and add length
                endSpan(StyleConstants.KEY_SIZE, store, index, buildingSpans);
            }

            // FAMILY
            else if (currTagText.toLowerCase().startsWith("f=")) {
                // start a new family span
                final String family = currTagText.substring(2);
                buildingSpans.add(new StyleSpan(StyleConstants.KEY_FAMILY, family, index, 0));
            } else if ("/f".equalsIgnoreCase(currTagText)) {
                // find last FAMILY entry and add length
                endSpan(StyleConstants.KEY_FAMILY, store, index, buildingSpans);
            } else {
                // not really a tag, so put it back.
                rVal.append('[');
                rVal.append(currTagText);
                rVal.append(']');
                tagStatus = TagStatus.NONE;
            }

            currTagText = "";
            continue;
        }

        // anything else
        rVal.append(token);
        index += token.length();
    }

    // close any remaining open tags
    while (!buildingSpans.isEmpty()) {
        final StyleSpan span = buildingSpans.getLast();
        endSpan(span.getStyle(), store, index, buildingSpans);
    }

    // return plain text
    return rVal.toString();
}

From source file:org.richfaces.tests.metamer.ftest.extension.configurator.config.CompositeConfigImpl.java

public CompositeConfigImpl(Config config) {
    this.configurations = Lists.newLinkedList();
    this.configurations.add(config.copy());
}

From source file:de.cosmocode.palava.ipc.json.custom.ThrowableEncoder.java

/**
 * Encodes the given throwable into a map.
 * // ww w.  ja  v a  2s  .  c om
 * @since 1.0
 * @param throwable the given throwable
 * @return a map containing all required information
 * @throws NullPointerException if throwable is null
 */
public Map<String, Object> encode(Throwable throwable) {
    Preconditions.checkNotNull(throwable, "Throwable");
    final Throwable root = Throwables.getRootCause(throwable);
    final Map<String, Object> map = Maps.newHashMap();

    map.put("name", root.getClass().getName());
    map.put("message", root.getMessage());

    final List<Map<String, Object>> stacktrace = Lists.newLinkedList();

    for (StackTraceElement element : root.getStackTrace()) {
        final Map<String, Object> mappedElement = Maps.newHashMap();

        mappedElement.put("class", element.getClassName());
        mappedElement.put("filename", element.getFileName());
        mappedElement.put("line", element.getLineNumber());
        mappedElement.put("method", element.getMethodName());

        stacktrace.add(mappedElement);
    }

    map.put("stacktrace", stacktrace);

    final List<String> superNames = Lists.newArrayList();
    fillSuperName(superNames, throwable.getClass());
    map.put("superNames", superNames);

    return map;
}