List of usage examples for java.util LinkedList LinkedList
public LinkedList()
From source file:view.visualization.TXTVisualization.java
public static LinkedList<String> atributi(String txt) { boolean kraj = false; LinkedList<String> atributi = new LinkedList<String>(); try {// ww w . j a v a 2 s . c om BufferedReader in = new BufferedReader(new FileReader(txt)); int br = Integer.parseInt(in.readLine().split(" ")[1]); for (int j = 0; j < br + 1; j++) { String pom = in.readLine(); if (pom.contains("@attribute") && pom.contains("numeric")) { atributi.add(pom.substring(11, pom.lastIndexOf("n") - 1)); } } in.close(); } catch (Exception e) { e.getMessage(); } return atributi; }
From source file:Main.java
/** * From http://stackoverflow.com/questions/13592236/parse-a-uri-string-into-name-value-collection *//* www . ja v a 2 s. c o m*/ public static Map<String, List<String>> splitQuery(String urlQuery) throws UnsupportedEncodingException { final Map<String, List<String>> query_pairs = new LinkedHashMap<>(); final String[] pairs = urlQuery.split("&"); for (String pair : pairs) { final int idx = pair.indexOf("="); final String key = idx > 0 ? URLDecoder.decode(pair.substring(0, idx), "UTF-8") : pair; if (!query_pairs.containsKey(key)) { query_pairs.put(key, new LinkedList<String>()); } final String value = idx > 0 && pair.length() > idx + 1 ? URLDecoder.decode(pair.substring(idx + 1), "UTF-8") : null; query_pairs.get(key).add(value); } return query_pairs; }
From source file:Main.java
public static <T> List<List<T>> partition(List<T> list, int partitionSize) { List<List<T>> results = new LinkedList<>(); for (int index = 0; index < list.size(); index += partitionSize) { int subListSize = Math.min(partitionSize, list.size() - index); results.add(list.subList(index, index + subListSize)); }//from w ww. j a v a2s. c om return results; }
From source file:Main.java
/** * Return a List of Element objects that have the given name and are immediate children of the * given element; if name is null, all child elements will be included. *//*from www.java 2 s . c o m*/ public static List<Element> childElementList(Element element, String childElementName) { if (element == null) return null; List<Element> elements = new LinkedList<Element>(); Node node = element.getFirstChild(); if (node != null) { do { if (node.getNodeType() == Node.ELEMENT_NODE && (childElementName == null || childElementName.equals(node.getNodeName()))) { Element childElement = (Element) node; elements.add(childElement); } } while ((node = node.getNextSibling()) != null); } return elements; }
From source file:Main.java
public static List childNodeList(Node node) { if (node == null) return null; List children = new LinkedList(); Node childNode = node.getFirstChild(); if (childNode != null) { do {/* w w w .j a va 2s.c om*/ if (childNode.getNodeType() == Node.ELEMENT_NODE) { children.add(childNode); } } while ((childNode = childNode.getNextSibling()) != null); } return children; }
From source file:Main.java
public static <T> Queue<T> newQueue() { return new LinkedList<T>(); }
From source file:Main.java
public static <T> Deque<T> newStack() { return new LinkedList<T>(); }
From source file:Main.java
public static <T> List<T> list() { return new LinkedList<T>(); }
From source file:Main.java
public static JComponent[] getAllSubComponents(Container root) { List<JComponent> comps = new LinkedList<JComponent>(); for (Component c : root.getComponents()) { try {// w ww . ja v a 2 s .c om comps.add((JComponent) c); comps.addAll(Arrays.asList(getAllSubComponents((JComponent) c))); } catch (final ClassCastException e) { continue; } } return comps.toArray(new JComponent[comps.size()]); }
From source file:Main.java
public static List<Field> getRealFields(Class objectClass) { List<Field> result = new LinkedList<Field>(); for (Field item : objectClass.getDeclaredFields()) { if (!item.isSynthetic()) result.add(item);/*w ww. j a v a 2 s . co m*/ } return result; }