Example usage for java.util LinkedList add

List of usage examples for java.util LinkedList add

Introduction

In this page you can find the example usage for java.util LinkedList add.

Prototype

public boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this list.

Usage

From source file:hu.ppke.itk.nlpg.purepos.POSTagger.java

protected String sentences2string(List<ISentence> sents, boolean showProb) {
    LinkedList<String> sentStrings = new LinkedList<String>();
    for (ISentence s : sents) {
        sentStrings.add(sentence2string(s, showProb));
    }/*from  w ww .  ja  v  a  2 s . c  om*/
    return Joiner.on("\t").join(sentStrings);
}

From source file:com.kpb.other.AcmeCorpPhysicalNamingStrategy.java

public Identifier toPhysicalSequenceName(Identifier name, JdbcEnvironment jdbcEnvironment) {
    final LinkedList<String> parts = splitAndReplace(name.getText());
    // Acme Corp says all sequences should end with _seq
    if (!"seq".equalsIgnoreCase(parts.getLast())) {
        parts.add("seq");
    }// w  w  w.j av a 2s . com
    return jdbcEnvironment.getIdentifierHelper().toIdentifier(join(parts), name.isQuoted());
}

From source file:com.espertech.esper.epl.core.ResultSetProcessorSimple.java

/**
 * Applies the select-clause to the given events returning the selected events. The number of events stays the
 * same, i.e. this method does not filter it just transforms the result set.
 * <p>//from   ww w  . ja  v a  2  s  . c  om
 * Also applies a having clause.
 * @param exprProcessor - processes each input event and returns output event
 * @param orderByProcessor - for sorting output events according to the order-by clause
 * @param events - input events
 * @param optionalHavingNode - supplies the having-clause expression
 * @param isNewData - indicates whether we are dealing with new data (istream) or old data (rstream)
 * @param isSynthesize - set to true to indicate that synthetic events are required for an iterator result set
 * @param exprEvaluatorContext context for expression evalauation
 * @return output events, one for each input event
 */
protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor,
        OrderByProcessor orderByProcessor, EventBean[] events, ExprEvaluator optionalHavingNode,
        boolean isNewData, boolean isSynthesize, ExprEvaluatorContext exprEvaluatorContext) {
    if (events == null) {
        return null;
    }

    LinkedList<EventBean> result = new LinkedList<EventBean>();
    List<EventBean[]> eventGenerators = null;
    if (orderByProcessor != null) {
        eventGenerators = new ArrayList<EventBean[]>();
    }

    EventBean[] eventsPerStream = new EventBean[1];
    for (EventBean theEvent : events) {
        eventsPerStream[0] = theEvent;

        Boolean passesHaving = (Boolean) optionalHavingNode.evaluate(eventsPerStream, isNewData,
                exprEvaluatorContext);
        if ((passesHaving == null) || (!passesHaving)) {
            continue;
        }

        result.add(exprProcessor.process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext));
        if (orderByProcessor != null) {
            eventGenerators.add(new EventBean[] { theEvent });
        }
    }

    if (!result.isEmpty()) {
        if (orderByProcessor != null) {
            return orderByProcessor.sort(result.toArray(new EventBean[result.size()]),
                    eventGenerators.toArray(new EventBean[eventGenerators.size()][]), isNewData,
                    exprEvaluatorContext);
        } else {
            return result.toArray(new EventBean[result.size()]);
        }
    } else {
        return null;
    }
}

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

public LinkedList<S> values() {
    final LinkedList<S> values = new LinkedList<>();
    for (final Pair<F, S> entry : list) {
        if (entry.getSecond() != null) {
            values.add(entry.getSecond());
        }//from ww w .j a va2s  .  c om
    }
    return values;
}

From source file:de.devmil.common.ui.color.HistorySelectorView.java

public JSONArray moveValueToFront(JSONArray array, int index, int color) throws JSONException {
    LinkedList<Integer> list = new LinkedList<Integer>();
    for (int i = 0; i < array.length(); i++) {
        list.add(array.getInt(i));
    }/*from   w w  w  .  j  a va2  s.  c o m*/

    list.add(color);
    list.remove(index);

    array = new JSONArray();
    for (int i : list) {
        array.put(i);
    }

    return array;
}

From source file:de.unidue.inf.is.ezdl.gframedl.converter.HTMLConversionStrategy.java

@Override
public ExportResult print(TextDocument document) {
    LinkedList<TextDocument> list = new LinkedList<TextDocument>();
    list.add(document);
    return print(list);
}

From source file:cn.tata.t2s.ssm.util.AcmeCorpPhysicalNamingStrategy.java

@Override
public Identifier toPhysicalSequenceName(Identifier name, JdbcEnvironment jdbcEnvironment) {
    final LinkedList<String> parts = splitAndReplace(name.getText());
    // Acme Corp says all sequences should end with _seq
    if (!"seq".equalsIgnoreCase(parts.getLast())) {
        parts.add("seq");
    }/*from  w w  w .j  a  v  a2s  .  c o m*/
    return jdbcEnvironment.getIdentifierHelper().toIdentifier(join(parts), name.isQuoted());
}

From source file:client.DockerPackageClient.java

/**
 * Convert a response from a docker registry GET tags call into a list of ImageMetadata objects,
 * effectively inverting the JSON map./*  w  w w.  ja  v  a 2  s.c om*/
 *
 * @param tagsResponse Convertible to JSON which is expected to look like:
 *  {
 *    "latest": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
 *    "0.1.1":  "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"
 *  }
 * @return A list of image's metadata
 */
private List<ImageMetadata> repoTagListToImages(final WSResponse tagsResponse, final String repoName) {
    final JsonNode jsonTagToShaMap = tagsResponse.asJson();
    final Map<String, List<String>> shaToTagList = Maps.newHashMap();

    final Iterator<Map.Entry<String, JsonNode>> tags = jsonTagToShaMap.fields();
    while (tags.hasNext()) {
        final Map.Entry<String, JsonNode> tagShaPair = tags.next();
        final String tagName = tagShaPair.getKey();
        final String sha = tagShaPair.getValue().textValue();
        // Add/create the tag list for this SHA
        if (shaToTagList.containsKey(sha)) {
            shaToTagList.get(sha).add(tagName);
        } else {
            final LinkedList<String> tagList = new LinkedList<>();
            tagList.add(tagName);
            shaToTagList.put(sha, tagList);
        }
    }

    final List<ImageMetadata> images = new LinkedList<>();
    shaToTagList.forEach((sha, tagList) -> images.add(new ImageMetadata(repoName, sha, tagList)));
    return images;
}

From source file:AndroidUninstallStock.java

public static LinkedList<String> getLibsInApk(Path apk) throws IOException {
    LinkedList<String> libs = new LinkedList<String>();
    try (JarInputStream jar = new JarInputStream(
            Files.newInputStream(apk, new StandardOpenOption[] { StandardOpenOption.READ }))) {
        JarEntry jent;//  w  w w .  j ava2  s  .  co m
        int pos;
        while ((jent = jar.getNextJarEntry()) != null) {
            if (!jent.isDirectory() && ((pos = jent.getName().indexOf("lib/")) == 0 || pos == 1)) {
                libs.add(jent.getName());
            }
        }
    }
    return libs;
}

From source file:com.addthis.hydra.task.map.DataPurgeServiceImpl.java

protected List<File> expandPrefix(String path) {
    if (path.indexOf('*') == -1) {
        LinkedList<File> list = new LinkedList<>();
        list.add(new File(path));
        return list;
    }//  ww  w  .ja  v  a  2 s .  c o m
    File cur = path.startsWith(dirSeperator) ? new File(dirSeperator) : new File(".");
    LinkedList<File> list = new LinkedList<>();
    String[] tokens = LessStrings.splitArray(path, dirRegexSeperator);
    expandPrefix(list, cur, tokens, 0);
    return list;
}