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:cz.cuni.mff.ksi.jinfer.autoeditor.automatonvisualizer.PluggableVisualizer.java

private static List<GraphMousePlugin> getDefaultGraphMousePlugins() {
    final LinkedList<GraphMousePlugin> list = new LinkedList<GraphMousePlugin>();
    list.add(new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, 1 / 1.1f, 1.1f));
    list.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON3_MASK));
    return list;/*from w ww . j  ava 2  s .c om*/
}

From source file:Main.java

/**
 * Returns a list of the direct {@link Element} children of the given element.
 *
 * @param parent//from www  .  ja v a  2  s.co m
 *            The {@link Element} to get the children from.
 * @return A {@link LinkedList} of the children {@link Element}s.
 */
public static LinkedList<Element> getDirectChildren(Element parent) {
    LinkedList<Element> list = new LinkedList<>();
    for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
        if (child instanceof Element) {
            list.add((Element) child);
        }
    }
    return list;
}

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 and subdirectories.
 *///from   w  w w .ja v a 2s.  com

public static LinkedList<Mp3FileAdvanced> mp3InDirectories(Path path) {
    Iterator it = FileUtils.iterateFiles(new File(path.toString()), new String[] { "mp3" }, true);
    LinkedList<Mp3FileAdvanced> mp3List = new LinkedList<>();
    while (it.hasNext()) {
        File file = (File) it.next();
        try {
            mp3List.add(new Mp3FileAdvanced(file));
        } catch (InvalidDataException | IOException | UnsupportedTagException e) {
            e.printStackTrace();
        }
    }
    return mp3List;
}

From source file:Main.java

public static Element[] getChildrenByName(Element e, String name) {
    NodeList nl = e.getChildNodes();
    int max = nl.getLength();
    LinkedList<Node> list = new LinkedList<Node>();
    for (int i = 0; i < max; i++) {
        Node n = nl.item(i);//from   w  ww . j a  v a 2  s . com
        if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) {
            list.add(n);
        }
    }
    return list.toArray(new Element[list.size()]);
}

From source file:exec.examples.IoHelper.java

public static List<Context> read(String zipFile) {
    LinkedList<Context> res = Lists.newLinkedList();
    try {//from   w  ww  .  ja v  a2s.com
        IReadingArchive ra = new ReadingArchive(new File(zipFile));
        while (ra.hasNext()) {
            res.add(ra.getNext(Context.class));
        }
        ra.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return res;
}

From source file:com.codenvy.commons.lang.TarUtils.java

private static void addDirectoryRecursively(TarArchiveOutputStream tarOut, String parentPath, File dir,
        long modTime, FilenameFilter filter) throws IOException {
    final int parentPathLength = parentPath.length() + 1;
    final LinkedList<File> q = new LinkedList<>();
    q.add(dir);
    while (!q.isEmpty()) {
        final File current = q.pop();
        final File[] list = current.listFiles();
        if (list != null) {
            for (File f : list) {
                if (filter.accept(current, f.getName())) {
                    final String entryName = f.getAbsolutePath().substring(parentPathLength).replace('\\', '/');
                    if (f.isDirectory()) {
                        addDirectoryEntry(tarOut, entryName, f, modTime);
                        q.push(f);//  ww w. jav  a 2s  .c o m
                    } else if (f.isFile()) {
                        addFileEntry(tarOut, entryName, f, modTime);
                    }
                }
            }
        }
    }
}

From source file:Main.java

public static Element[] getChildrenByName(Element parentElement, String childrenName) {
    NodeList nl = parentElement.getChildNodes();
    int max = nl.getLength();
    LinkedList<Node> list = new LinkedList<Node>();
    for (int i = 0; i < max; i++) {
        Node n = nl.item(i);/*  ww  w  .  j a v  a  2  s.c o  m*/
        if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(childrenName)) {
            list.add(n);
        }
    }
    return list.toArray(new Element[list.size()]);
}

From source file:Main.java

public static String[] getChildrenText(Element parentElement, String childrenName) {
    NodeList nl = parentElement.getChildNodes();
    int max = nl.getLength();
    LinkedList<String> list = new LinkedList<String>();
    for (int i = 0; i < max; i++) {
        Node n = nl.item(i);//from ww w. j av a2  s  .c o m
        if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(childrenName)) {
            list.add(getText((Element) n));
        }
    }
    return list.toArray(new String[list.size()]);
}

From source file:net.portalblock.untamedchat.bungee.UCConfig.java

private static String[] makeCommandArray(JSONArray array, String... defs) {
    if (array == null)
        return defs;
    LinkedList<String> val = new LinkedList<String>();
    for (int i = 0; i < array.length(); i++) {
        val.add(array.getString(i));
    }/*  w w w .j  a  va2 s  .  c  om*/
    return val.toArray(new String[val.size()]);
}

From source file:Main.java

/**
 * Get all the direct children elements of an element.
 *
 * @param parent//from w  ww.j  a v  a 2  s.  c  o  m
 *            The parent element.
 *
 * @return A list of Element's.
 */
public static List<Element> getElements(final Element parent) {
    final LinkedList<Element> list = new LinkedList<Element>();

    Node node = parent.getFirstChild();

    while (node != null) {
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            list.add((Element) node);
        }

        node = node.getNextSibling();
    }

    return list;
}