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:eu.stratosphere.pact.test.pactPrograms.WebLogAnalysisITCase.java

@Parameters
public static Collection<Object[]> getConfigurations() {

    LinkedList<Configuration> tConfigs = new LinkedList<Configuration>();

    Configuration config = new Configuration();
    config.setInteger("WebLogAnalysisTest#NoSubtasks", 4);
    tConfigs.add(config);

    return toParameterList(tConfigs);
}

From source file:eu.morfeoproject.fast.catalogue.builder.BuildingBlockJSONBuilder.java

public static List<Pipe> buildPipes(Screen screen, JSONArray pipesArray) throws JSONException, IOException {
    LinkedList<Pipe> pipes = new LinkedList<Pipe>();
    for (int i = 0; i < pipesArray.length(); i++) {
        pipes.add(parsePipe(screen, pipesArray.getJSONObject(i)));
    }// w w  w . ja  v a 2s  .c o  m
    return pipes;
}

From source file:com.insightml.utils.Collections.java

public static <T, N extends Number> LinkedList<Pair<T, N>> getMax(final Iterable<Pair<T, N>> map) {
    LinkedList<Pair<T, N>> maxEntry = new LinkedList<>();
    for (final Pair<T, N> entry : map) {
        if (maxEntry.size() == 0
                || entry.getSecond().doubleValue() > maxEntry.getFirst().getSecond().doubleValue()) {
            maxEntry = new LinkedList<>();
            maxEntry.add(entry);
        } else if (entry.getSecond().doubleValue() == maxEntry.getFirst().getSecond().doubleValue()) {
            maxEntry.add(entry);//from   www  . jav  a 2s .c o m
        }
    }
    return maxEntry;
}

From source file:at.bitfire.davdroid.resource.LocalTaskList.java

public static LocalTaskList[] findAll(Account account, ContentProviderClient providerClient)
        throws RemoteException {
    @Cleanup// w w w . ja va2s.  com
    Cursor cursor = providerClient.query(taskListsURI(account),
            new String[] { TaskContract.TaskLists._ID, TaskContract.TaskLists._SYNC_ID }, null, null, null);

    LinkedList<LocalTaskList> taskList = new LinkedList<>();
    while (cursor != null && cursor.moveToNext())
        taskList.add(new LocalTaskList(account, providerClient, cursor.getInt(0), cursor.getString(1)));
    return taskList.toArray(new LocalTaskList[taskList.size()]);
}

From source file:eu.morfeoproject.fast.catalogue.builder.BuildingBlockJSONBuilder.java

public static List<Trigger> buildTriggers(Screen screen, JSONArray triggersArray)
        throws JSONException, IOException {
    LinkedList<Trigger> triggers = new LinkedList<Trigger>();
    for (int i = 0; i < triggersArray.length(); i++) {
        triggers.add(parseTrigger(screen, triggersArray.getJSONObject(i)));
    }/* w w w  .  j  a v a2s .c o m*/
    return triggers;
}

From source file:de.vanita5.twittnuker.util.net.ssl.AbstractCheckSignatureVerifier.java

public static final boolean verify(final String host, final String[] cns, final String[] subjectAlts,
        final boolean strictWithSubDomains) {

    // Build the list of names we're going to check. Our DEFAULT and
    // STRICT implementations of the HostnameVerifier only use the
    // first CN provided. All other CNs are ignored.
    // (Firefox, wget, curl, Sun Java 1.4, 5, 6 all work this way).
    final LinkedList<String> names = new LinkedList<String>();
    if (cns != null && cns.length > 0 && cns[0] != null) {
        names.add(cns[0]);
    }/*from   www .ja v  a  2s .  c  om*/
    if (subjectAlts != null) {
        for (final String subjectAlt : subjectAlts) {
            if (subjectAlt != null) {
                names.add(subjectAlt);
            }
        }
    }

    if (names.isEmpty())
        return false;

    // StringBuilder for building the error message.
    final StringBuilder buf = new StringBuilder();

    // We're can be case-insensitive when comparing the host we used to
    // establish the socket to the hostname in the certificate.
    final String hostName = normaliseIPv6Address(host.trim().toLowerCase(Locale.US));
    boolean match = false;
    for (final Iterator<String> it = names.iterator(); it.hasNext();) {
        // Don't trim the CN, though!
        String cn = it.next();
        cn = cn.toLowerCase(Locale.US);
        // Store CN in StringBuilder in case we need to report an error.
        buf.append(" <");
        buf.append(cn);
        buf.append('>');
        if (it.hasNext()) {
            buf.append(" OR");
        }

        // The CN better have at least two dots if it wants wildcard
        // action. It also can't be [*.co.uk] or [*.co.jp] or
        // [*.org.uk], etc...
        final String parts[] = cn.split("\\.");
        final boolean doWildcard = parts.length >= 3 && parts[0].endsWith("*") && validCountryWildcard(cn)
                && !isIPAddress(host);

        if (doWildcard) {
            final String firstpart = parts[0];
            if (firstpart.length() > 1) { // e.g. server*
                // e.g. server
                final String prefix = firstpart.substring(0, firstpart.length() - 1);
                // skip wildcard part from cn
                final String suffix = cn.substring(firstpart.length());// skip
                // wildcard part from host
                final String hostSuffix = hostName.substring(prefix.length());
                match = hostName.startsWith(prefix) && hostSuffix.endsWith(suffix);
            } else {
                match = hostName.endsWith(cn.substring(1));
            }
            if (match && strictWithSubDomains) {
                // If we're in strict mode, then [*.foo.com] is not
                // allowed to match [a.b.foo.com]
                match = countDots(hostName) == countDots(cn);
            }
        } else {
            match = hostName.equals(normaliseIPv6Address(cn));
        }
        if (match) {
            break;
        }
    }
    return match;
}

From source file:eu.morfeoproject.fast.catalogue.builder.BuildingBlockJSONBuilder.java

/**
 * Every statement of the conditions has to follow this rules:
 * <ul>/*from   www.  j  a  v  a 2 s  . c  o  m*/
 *   <li>Subject must be a variable</li>
 *   <li>Predicate must be a URI</li>
 *   <li>Object can be a variable or a URI</li>
 * </ul>
 * @param conditionsArray
 * @return list of constructed conditions
 * @throws JSONException
 * @throws IOException 
 */
@SuppressWarnings("unchecked")
public static List<Condition> buildConditions(JSONArray conditionsArray) throws JSONException, IOException {
    LinkedList<Condition> conditions = new LinkedList<Condition>();
    for (int i = 0; i < conditionsArray.length(); i++) {
        conditions.add(buildCondition(conditionsArray.getJSONObject(i)));
    }
    return conditions;
}

From source file:com.baidu.rigel.biplatform.tesseract.util.QueryRequestUtil.java

/**
 * /*from w  ww  .j av a  2  s  .com*/
 * transQueryRequest2SqlQuery queryRequest->sqlQuery
 * 
 * @param query
 *            query
 * @return SqlQuery SqlQuery
 */
public static SqlQuery transQueryRequest2SqlQuery(QueryRequest query) {
    if (query == null || query.getWhere() == null) {
        throw new IllegalArgumentException();
    }

    SqlQuery result = new SqlQuery();
    // ?from
    if (query.getGroupBy() != null) {
        result.setGroupBy(query.getGroupBy().getGroups());
    }

    LinkedList<String> fromList = new LinkedList<String>();
    fromList.add(query.getFrom().getFrom());
    result.setFromList(fromList);
    // ?limit
    if (query.getLimit() != null) {
        result.setLimitMap(query.getLimit().getStart(), query.getLimit().getSize());
    }

    // ?select
    // getQueryProperties
    Set<String> selectList = Sets.newLinkedHashSet();
    if (query.getSelect() != null) {
        selectList.addAll(query.getSelect().getQueryProperties());
        if (CollectionUtils.isNotEmpty(query.getSelect().getQueryMeasures())) {
            for (QueryMeasure qm : query.getSelect().getQueryMeasures()) {
                selectList.add(qm.getProperties());
            }
        }
    }

    // ?where
    Map<String, List<String>> andCondition = transQueryRequestAndList2Map(query);
    List<String> whereList = new ArrayList<String>();
    for (String key : andCondition.keySet()) {
        selectList.add(key);
        StringBuilder sb = new StringBuilder();
        sb.append(key);
        sb.append(" in (");
        sb.append(StringUtils.join(transValue2SqlString(andCondition.get(key)), ","));
        sb.append(")");
        whereList.add(sb.toString());
    }
    result.setWhereList(whereList);
    result.getSelectList().addAll(selectList);
    return result;
}

From source file:de.tu_dortmund.ub.data.dswarm.TaskProcessingUnit.java

private static void executeExport(final String exportDataModelID, final Optional<String> optionalExportMimeType,
        final Optional<String> optionalExportFileExtension, final Integer engineThreads,
        final String serviceName, final Properties config) throws Exception {

    // create job list
    final LinkedList<Callable<String>> exports = new LinkedList<>();
    exports.add(new Export(exportDataModelID, optionalExportMimeType, optionalExportFileExtension, config));

    // work on jobs
    final ThreadPoolExecutor pool = new ThreadPoolExecutor(engineThreads, engineThreads, 0L, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>());

    execute(serviceName, exports, pool);
}

From source file:de.tu_dortmund.ub.data.dswarm.TaskProcessingUnit.java

private static void executeTransform(final String inputDataModelID, final String outputDataModelID,
        final Optional<Boolean> optionalDoIngestOnTheFly, final Optional<Boolean> optionalDoExportOnTheFly,
        final Optional<String> optionalExportMimeType, final Optional<String> optionalExportFileExtension,
        final Integer engineThreads, final String serviceName, final Properties config) throws Exception {

    // create job list
    final LinkedList<Callable<String>> transforms = new LinkedList<>();
    transforms.add(new Transform(config, inputDataModelID, outputDataModelID, optionalDoIngestOnTheFly,
            optionalDoExportOnTheFly, optionalExportMimeType, optionalExportFileExtension, 0));

    // work on jobs
    final ThreadPoolExecutor pool = new ThreadPoolExecutor(engineThreads, engineThreads, 0L, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>());

    execute(serviceName, transforms, pool);
}