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.test.exampleRecordPrograms.GlobalSortingITCase.java

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

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

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

    return toParameterList(tConfigs);
}

From source file:de.cubeisland.engine.core.util.McUUID.java

private static List<Profile> getUUIDForNames0(Collection<String> playernames) {
    LinkedList<String> players = new LinkedList<>();
    List<Profile> profiles = new ArrayList<>();
    for (String playername : new HashSet<>(playernames)) {
        players.add(playername);
        if (players.size() >= 20) {
            getProfiles(profiles, players);
            CubeEngine.getLog().info(profiles.size() + "/" + playernames.size());
        }/*  ww w  . jav a 2 s  .  c o  m*/
    }
    getProfiles(profiles, players);
    CubeEngine.getLog().info("Getting UUIDs done!", playernames.size());
    return profiles;
}

From source file:com.scit.sling.test.MockResourceFactory.java

private static ResourceNode parseJsonObject(ResourceNode context, JsonParser jp)
        throws JsonParseException, IOException {
    JsonToken token;//w w  w.ja  v  a  2s .co  m
    String fieldname = "";
    while ((token = jp.nextToken()) != JsonToken.END_OBJECT) {
        switch (token) {
        case START_OBJECT:
            ResourceNode child = new ResourceNode(context, fieldname);
            context.addChild(child);
            parseJsonObject(child, jp);
            break;
        case FIELD_NAME:
            fieldname = jp.getCurrentName();
            break;
        case START_ARRAY:
            LinkedList<Object> array = new LinkedList<Object>();
            while ((token = jp.nextToken()) != JsonToken.END_ARRAY) {
                array.add(parseValue(token, jp));
            }
            context.addProperty(fieldname, array.toArray());
            break;
        default:
            if (token.isScalarValue()) {
                context.addProperty(fieldname, parseValue(token, jp));
            }
            // log.warnd ???
        }
    }
    return context;
}

From source file:eu.stratosphere.pact.test.pactPrograms.TPCHQueryAsterixITCase.java

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

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

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

    return toParameterList(tConfigs);
}

From source file:gr.aueb.cs.nlp.wordtagger.data.structure.WordSet.java

/**
 * loads a wordset from a file/*from   w w w . j a va  2s .c o  m*/
 * @param path
 * @param delimeter
 * @return
 */
public static List<Word> fileToList(String path, String delimeter) {
    final LinkedList<Word> testSet = new LinkedList<>();
    FileHelper.readFile(path, new CallBack<String>() {
        @Override
        public void call(String t) {
            String[] a = t.split(delimeter);
            testSet.add(new Word(a[0], a[1]));
        }
    });
    return testSet;
}

From source file:es.emergya.cliente.constants.LogicConstantsUI.java

public static String[] getPriorities(boolean b) {
    LinkedList<String> res = new LinkedList<String>();
    if (b)/*from  w w w.  j  a  v  a  2  s .  c om*/
        res.add("");
    for (Integer i = LogicConstantsUI.getInt("LOWEST_PRIORITY", 0); i < LogicConstantsUI
            .getInt("HIGHEST_PRIORITY", 9); i++)
        res.add(i.toString());
    return res.toArray(new String[0]);
}

From source file:es.emergya.cliente.constants.LogicConstants.java

public static String[] getPriorities(boolean b) {
    LinkedList<String> res = new LinkedList<String>();
    if (b)/*from   w ww  . j a va  2  s  .c  o  m*/
        res.add("");
    for (Integer i = LogicConstants.getInt("LOWEST_PRIORITY", 0); i < LogicConstants.getInt("HIGHEST_PRIORITY",
            9); i++)
        res.add(i.toString());
    return res.toArray(new String[0]);
}

From source file:Main.java

public static LinkedList<File> listLinkedFiles(String strPath) {
    LinkedList<File> list = new LinkedList<File>();
    File dir = new File(strPath);
    if (!dir.isDirectory()) {
        return null;
    }//  w w  w .  j ava  2 s . c om
    File file[] = dir.listFiles();
    for (int i = 0; i < file.length; i++) {
        if (file[i].isDirectory())
            list.add(file[i]);
        else
            System.out.println(file[i].getAbsolutePath());
    }
    File tmp;
    while (!list.isEmpty()) {
        tmp = (File) list.removeFirst();
        if (tmp.isDirectory()) {
            file = tmp.listFiles();
            if (file == null)
                continue;
            for (int i = 0; i < file.length; i++) {
                if (file[i].isDirectory())
                    list.add(file[i]);
                else
                    System.out.println(file[i].getAbsolutePath());
            }
        } else {
            System.out.println(tmp.getAbsolutePath());
        }
    }
    return list;
}

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

public static <T> LinkedList<T> merge(final Iterable<? extends Iterable<T>> run) {
    final LinkedList<T> list = new LinkedList<>();
    for (final Iterable<T> l : run) {
        for (final T e : l) {
            list.add(e);
        }//w  w  w . ja  v  a2  s  .com
    }
    return list;
}

From source file:com.bwc.ora.OraUtils.java

public static void setLrpsForAnalysis() {
    Lrp fovealLrp = lrpCollection.getFovealLrp();
    if (fovealLrp == null) {
        return;//from   ww  w. j av a 2 s  . c o m
    }

    LrpSettings lrpSettings = ModelsCollection.getInstance().getLrpSettings();
    int octWidth = Oct.getInstance().getImageWidth();
    int distanceBetweenLrps = lrpSettings.getLrpSeperationDistanceInPixels();
    int numberOfLrpTotal = lrpSettings.getNumberOfLrp();
    int lrpPosToLeftOfFovea = fovealLrp.getLrpCenterXPosition();
    int lrpPosToRightOfFovea = fovealLrp.getLrpCenterXPosition();
    LinkedList<Lrp> lrps = new LinkedList<>();
    lrps.add(fovealLrp);
    while (lrps.size() < numberOfLrpTotal) {
        lrpPosToLeftOfFovea -= distanceBetweenLrps;
        lrps.push(new Lrp("Left " + ((lrps.size() + 1) / 2), lrpPosToLeftOfFovea,
                fovealLrp.getLrpCenterYPosition(), lrpSettings.getLrpWidth(), lrpSettings.getLrpHeight(),
                LrpType.PERIPHERAL));

        lrpPosToRightOfFovea += distanceBetweenLrps;
        if (lrps.size() < numberOfLrpTotal) {
            lrps.add(new Lrp("Right " + (lrps.size() / 2), lrpPosToRightOfFovea,
                    fovealLrp.getLrpCenterYPosition(), lrpSettings.getLrpWidth(), lrpSettings.getLrpHeight(),
                    LrpType.PERIPHERAL));
        }
    }

    boolean illegalPositionLrps = lrps.stream()
            .anyMatch(lrp -> lrp.getLrpCenterXPosition() - ((lrpSettings.getLrpWidth() - 1) / 2) < 0
                    || lrp.getLrpCenterXPosition() + ((lrpSettings.getLrpWidth() - 1) / 2) >= octWidth);

    if (illegalPositionLrps) {
        throw new IllegalArgumentException("Combination of LRP width, the number of LRPs and LRP "
                + "separation distance cannot fit within the bounds of the OCT.");
    }
    lrpCollection.setLrps(lrps);
}