List of usage examples for java.util LinkedList add
public boolean add(E e)
From source file:Main.java
public static LinkedList<String> retrieveStringFromCursor(Cursor cursor, String columnName) { LinkedList<String> result = new LinkedList<String>(); if (null == cursor || 0 == cursor.getCount()) { return result; }//from w w w . j av a 2 s . com try { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { String str = cursor.getString(cursor.getColumnIndexOrThrow(columnName)); result.add(str); } } catch (Exception e) { //do nothing. } finally { cursor.close(); } return result; }
From source file:org.epics.archiverappliance.utils.ui.URIUtils.java
/** * If you do expect a param to have multiple values, use this method to get all the possible values for a name. * @param uri URI /* w w w . ja v a 2s . c o m*/ * @param paramName   * @return multiple values of a param * @throws IOException   */ public static List<String> getMultiValuedParamFromQueryString(URI uri, String paramName) throws IOException { LinkedList<String> ret = new LinkedList<String>(); if (uri == null) return ret; List<NameValuePair> nvs = URLEncodedUtils.parse(uri, "UTF-8"); if (nvs == null) return ret; for (NameValuePair nv : nvs) { if (nv.getName().equals(paramName)) { ret.add(nv.getValue()); } } return ret; }
From source file:com.insightml.utils.Collections.java
public static <V> LinkedList<V> values(final List<? extends Pair<?, V>> run) { final LinkedList<V> values = new LinkedList<>(); for (final Pair<?, V> entry : run) { if (entry.getValue() != null) { values.add(entry.getValue()); }/*from ww w.jav a2s. c o m*/ } return values; }
From source file:org.kitodo.sruimport.ResponseHandler.java
private static LinkedList<Record> extractHits(Document document) { LinkedList<Record> hits = new LinkedList<>(); NodeList records = document.getElementsByTagNameNS(SRW_NAMESPACE, SRW_RECORD_TAG); for (int i = 0; i < records.getLength(); i++) { Element recordElement = (Element) records.item(i); hits.add(new Record(getRecordTitle(recordElement), getRecordID(recordElement))); }/*from w ww .jav a 2s . c om*/ return hits; }
From source file:Main.java
/** * Get all the direct children elements of an element that have a specific * tag name.// ww w. ja v a 2 s . c om * * @param parent * The parent element. * @param name * The tag name to match. * * @return A list of Element's. */ public static List<Element> getElements(final Element parent, final String name) { final LinkedList<Element> list = new LinkedList<Element>(); Node node = parent.getFirstChild(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { final Element element = (Element) node; if (element.getTagName().equals(name)) { list.add(element); } } node = node.getNextSibling(); } return list; }
From source file:de.hasait.clap.impl.CLAPClassNode.java
private static <A extends Annotation> A findAnnotation(final Class<?> pClass, final Class<A> pAnnotationClass) { final LinkedList<Class<?>> queue = new LinkedList<Class<?>>(); queue.add(pClass); while (!queue.isEmpty()) { final Class<?> clazz = queue.removeFirst(); if (clazz != null) { final A result = clazz.getAnnotation(pAnnotationClass); if (result != null) { return result; }//ww w. ja v a 2s .c o m queue.add(clazz.getSuperclass()); for (final Class<?> interfaze : clazz.getInterfaces()) { queue.add(interfaze); } } } return null; }
From source file:Main.java
public static List<org.w3c.dom.Node> getMatchingChildren(org.w3c.dom.Node node, String name) { if (node == null) { return null; }//w w w .jav a 2 s . c o m LinkedList<org.w3c.dom.Node> returnList = new LinkedList<org.w3c.dom.Node>(); org.w3c.dom.NodeList childList = node.getChildNodes(); int len = childList.getLength(); for (int i = 0; i < len; i++) { org.w3c.dom.Node curNode = childList.item(i); if (name.equals(curNode.getNodeName())) { returnList.add(curNode); } } return returnList; }
From source file:dk.netarkivet.common.utils.ProcessUtils.java
/** * Runs a system process (Unix sort) to sort a file. * @param inputFile the input file./*from w w w.j a v a 2s .co m*/ * @param outputFile the output file. * @param tempDir the directory where to store temporary files (null for default system temp). * @param crawllogSorting Should we sort crawllog style ("-k 4b") or not * @return the process exit code. */ public static int runUnixSort(File inputFile, File outputFile, File tempDir, boolean crawllogSorting) { String[] environment = new String[] { "LANG=C" }; LinkedList<String> cmdAndParams = new LinkedList<String>(); cmdAndParams.add("sort"); cmdAndParams.add(inputFile.getAbsolutePath()); if (crawllogSorting) { // -k 4b means fourth field (from 1) ignoring leading blanks cmdAndParams.add("-k"); cmdAndParams.add("4b"); } // -o means output to (file) cmdAndParams.add("-o"); cmdAndParams.add(outputFile.getAbsolutePath()); if (tempDir != null) { // -T configures where to store temporary files cmdAndParams.add("-T"); cmdAndParams.add(tempDir.getAbsolutePath()); } return ProcessUtils.runProcess(environment, (String[]) cmdAndParams.toArray(new String[cmdAndParams.size()])); }
From source file:eu.stratosphere.fuzzyjoin.test.TestA.java
@Parameters public static Collection<Object[]> getConfigurations() { LinkedList<Configuration> tConfigs = new LinkedList<Configuration>(); Configuration config = new Configuration(); config.setInteger("WordCountTest#NoSubtasks", 4); tConfigs.add(config); return toParameterList(tConfigs); }
From source file:dk.dma.ais.lib.FileConvert.java
/** * getOutputSinks//from ww w. j a v a 2s.c o m * * @return */ static final List<String> getOutputSinks() { LinkedList<String> methods = new LinkedList<String>(); Field[] declaredMethods = AisPacketOutputSinks.class.getDeclaredFields(); for (Field m : declaredMethods) { if (m.getName().startsWith("OUTPUT")) { methods.add(m.getName()); } } return methods; }