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.contracts.MapITCase.java

@Parameters
public static Collection<Object[]> getConfigurations() throws FileNotFoundException, IOException {
    LinkedList<Configuration> testConfigs = new LinkedList<Configuration>();

    Configuration config = new Configuration();
    config.setInteger("MapTest#NoSubtasks", 4);
    testConfigs.add(config);

    return toParameterList(MapITCase.class, testConfigs);
}

From source file:com.appnexus.opensdk.ANJAMImplementation.java

private static void callMayDeepLink(WebView webView, Uri uri) {
    boolean mayDeepLink;
    String cb = uri.getQueryParameter("cb");
    String urlParam = uri.getQueryParameter("url");

    if ((webView.getContext() == null) || (webView.getContext().getPackageManager() == null)
            || (urlParam == null)) {//from w  ww .  ja  v  a  2  s  .  co m
        mayDeepLink = false;
    } else {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Uri.decode(urlParam)));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mayDeepLink = intent.resolveActivity(webView.getContext().getPackageManager()) != null;
    }

    LinkedList<BasicNameValuePair> list = new LinkedList<BasicNameValuePair>();
    list.add(new BasicNameValuePair(KEY_CALLER, CALL_MAYDEEPLINK));
    list.add(new BasicNameValuePair("mayDeepLink", String.valueOf(mayDeepLink)));
    loadResult(webView, cb, list);
}

From source file:com.appnexus.opensdk.ANJAMImplementation.java

private static void callDeepLink(WebView webView, Uri uri) {
    String cb = uri.getQueryParameter("cb");
    String urlParam = uri.getQueryParameter("url");

    LinkedList<BasicNameValuePair> list = new LinkedList<BasicNameValuePair>();
    list.add(new BasicNameValuePair(KEY_CALLER, CALL_DEEPLINK));

    if ((webView.getContext() == null) || (urlParam == null)) {
        loadResult(webView, cb, list);/*from  w ww.j  a v  a  2  s  .  co m*/
        return;
    }
    try {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Uri.decode(urlParam)));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        webView.getContext().startActivity(intent);
    } catch (ActivityNotFoundException e) {
        loadResult(webView, cb, list);
    }
}

From source file:com.appnexus.opensdk.ANJAMImplementation.java

private static void callGetDeviceID(WebView webView, Uri uri) {
    String cb = uri.getQueryParameter("cb");
    String idValue;//from w  w w.j a v  a  2s  .co m
    String idNameValue;

    if (!StringUtil.isEmpty(Settings.getSettings().aaid)) {
        idValue = Settings.getSettings().aaid;
        idNameValue = "aaid";
    } else {
        idValue = Settings.getSettings().hidsha1;
        idNameValue = "sha1udid";
    }

    LinkedList<BasicNameValuePair> list = new LinkedList<BasicNameValuePair>();
    list.add(new BasicNameValuePair(KEY_CALLER, CALL_GETDEVICEID));
    list.add(new BasicNameValuePair("idname", idNameValue));
    list.add(new BasicNameValuePair("id", idValue));
    loadResult(webView, cb, list);
}

From source file:Main.java

public static Element[] getChildrenByName(Element element, String paramString) {
    NodeList localNodeList = element.getChildNodes();
    int i = localNodeList.getLength();
    LinkedList<Node> nodes = new LinkedList<Node>();
    for (int j = 0; j < i; ++j) {
        Node localNode = localNodeList.item(j);
        if ((localNode.getNodeType() != 1) || (!localNode.getNodeName().equals(paramString)))
            continue;
        nodes.add(localNode);
    }// w w w  .j  a  v  a 2  s.  c  o  m
    return (Element[]) nodes.toArray(new Element[nodes.size()]);
}

From source file:com.pixlabs.web.utils.Mp3Finder.java

/**
 * @param path Path of the directory that should be looked into.
 * @return a linkedlist containing all the Mp3 files found in the directory.
 * @throws NotDirectoryException The given path was not a directory.
 *///from  ww w .j a  v  a2  s  .  co m

public static LinkedList<Mp3FileAdvanced> mp3InDirectory(Path path) throws NotDirectoryException {
    if (!Files.isDirectory(path))
        throw new NotDirectoryException("The chosen path does not represent a directory");
    LinkedList<Mp3FileAdvanced> list = new LinkedList<>();
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(path, "*.mp3")) {
        for (Path entry : stream) {
            //       if(!entry.startsWith("."))
            list.add(new Mp3FileAdvanced(entry.toFile()));
        }

    } catch (IOException | UnsupportedTagException | InvalidDataException e) {
        e.printStackTrace();
    }
    return list;
}

From source file:me.neatmonster.spacertk.scheduler.Scheduler.java

/**
 * Loads all the saved jobs from the file
 *///from  ww w .  ja v a  2s  .  com
public static void loadJobs() {
    if (!JOBS_FILE.exists())
        try {
            JOBS_FILE.createNewFile();
        } catch (final IOException e) {
            e.printStackTrace();
        }
    final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(JOBS_FILE);
    final LinkedList<String> jobsNames = new LinkedList<String>();
    for (final String key : configuration.getKeys(false))
        if (key.contains("."))
            jobsNames.add(key.split("\\.")[0]);
    for (final String jobName : jobsNames)
        if (!jobs.containsKey(jobName)) {
            final String timeType = configuration.getString(jobName + ".TimeType");
            final String timeArgument = configuration.getString(jobName + ".TimeArgument");
            final String actionName = configuration.getString(jobName + ".ActionName");
            @SuppressWarnings("unchecked")
            final Object[] actionArguments = ((List<Object>) JSONValue
                    .parse((String) configuration.get(jobName + ".ActionArguments"))).toArray();
            try {
                final Job job = new Job(actionName, actionArguments, timeType, timeArgument, true);
                jobs.put(jobName, job);
            } catch (final UnSchedulableException e) {
                e.printStackTrace();
            } catch (final UnhandledActionException e) {
                e.printStackTrace();
            }
        }
    try {
        configuration.save(JOBS_FILE);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:it.cnr.istc.iloc.gui.StateVariableVisualizer.java

private static String toString(Atom atom) {
    StringBuilder sb = new StringBuilder();
    sb.append(atom.type.name).append("(");
    LinkedList<Type> queue = new LinkedList<>();
    queue.add(atom.type);
    while (!queue.isEmpty()) {
        Type c_type = queue.pollFirst();
        queue.addAll(c_type.getSuperclasses());
        for (Field field : c_type.getFields()) {
            if (!field.synthetic && !field.name.equals(SCOPE)) {
                IItem item = atom.get(field.name);
                sb.append(", ").append(field.name);
                switch (field.type.name) {
                case BOOL:
                    sb.append(" = ").append(((IBoolItem) item).getBoolVar().evaluate());
                    break;
                case REAL:
                    sb.append(" = ").append(atom.core.evaluate(((IArithItem) item).getArithVar()));
                    break;
                case STRING:
                    sb.append(" = ").append(((IStringItem) item).getValue());
                    break;
                }/*from ww w .j  av  a  2  s.  c  o m*/
            }
        }
    }
    sb.append(")");
    return sb.toString().replace("(, ", "(");
}

From source file:Main.java

/**
 * //  www  . ja  va 2 s.c  o  m
 * @param aFile
 * @return
 */
public static String getLastLines(String filename, int number) {
    File aFile = new File(filename);
    StringBuilder contents = new StringBuilder();
    LinkedList<String> ll = new LinkedList<String>();

    try {
        BufferedReader input = new BufferedReader(new FileReader(aFile));
        try {
            String line = null;
            while ((line = input.readLine()) != null) {
                ll.add(line);
            }
        } finally {
            input.close();
        }
    } catch (IOException ex) {
        Log.e(TAG, ex.getMessage());
    }

    if ((ll.size() - number) <= 0) {
        Log.e(TAG, "Requested number of lines exceeds lines of file");
        return "Requested number of lines exceeds lines of file";
    }

    for (int i = (ll.size() - 1); i >= (ll.size() - number); i--) {
        contents.append(ll.get(i - 1));
        contents.append("\n");
    }

    return contents.toString();
}

From source file:mx.unam.ecologia.gye.coalescence.model.UniParentalGene.java

public static final void traverse(UniParentalGene upgene, UniParentalGeneVisitor visitor) {
    //log.debug("traverse()");
    LinkedList<UniParentalGene> queue = new LinkedList<UniParentalGene>();
    if (upgene.isAncestor()) {
        queue.add(upgene);
    } else {/*from w ww. jav  a 2s  .  co  m*/
        return; //nothing to be done!
    }
    while (!(queue.isEmpty())) {
        UniParentalGene upg = (UniParentalGene) queue.removeFirst();
        visitor.visit(upg);
        //log.debug("traverse()::Visited " + upg.toNHXString());

        if (upg.m_LDescendant != null) {
            queue.add(upg.m_LDescendant);
        }
        if (upg.m_RDescendant != null) {
            queue.add(upg.m_RDescendant);
        }
    }
}