List of usage examples for java.util List addAll
boolean addAll(Collection<? extends E> c);
From source file:functionaltests.runasme.TestRunAsMeLinuxKey.java
@BeforeClass public static void startDedicatedScheduler() throws Exception { assumeTrue(OperatingSystem.getOperatingSystem() == OperatingSystem.unix); setupUser();// ww w . ja va 2 s .c o m String keyPath = System.getProperty(RUNASME_KEY_PATH_PROPNAME); assumeNotNull(keyPath); key = IOUtils.toByteArray(new File(keyPath).toURI()); RMFactory.setOsJavaProperty(); // start an empty scheduler and add a node source with modified properties schedulerHelper = new SchedulerTHelper(true, true); List<String> arguments = new ArrayList<>(); arguments.addAll(RMTHelper.setup.getJvmParametersAsList()); arguments.add("-D" + ForkerUtils.FORK_METHOD_KEY + "=" + ForkerUtils.ForkMethod.KEY.toString()); schedulerHelper.createNodeSource("RunAsMeNSKey", 5, arguments); }
From source file:Main.java
public static <T extends Comparable<? super T>> void sort(List<T> list) { List<T> sortableList = new ArrayList<>(list); Collections.sort(sortableList); list.clear();/*from ww w.j a va2 s . c o m*/ list.addAll(sortableList); }
From source file:io.github.retz.scheduler.Applications.java
public static List<Application> getAll() { List<Application> apps = new LinkedList<>(); apps.addAll(get().values()); return apps;/* w w w.j ava 2s .c o m*/ }
From source file:Main.java
/** * Adds all elements of the <code>src</code> collections to <code>dest</code>, * returning <code>dest</code>. This is typically used when you need to combine * collections temporarily for a method argument. * * @since 1.0.7//w w w . ja va 2 s.c om */ public static <T> List<T> combine(List<T> dest, Collection<T>... src) { for (Collection<T> cc : src) { dest.addAll(cc); } return dest; }
From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.significance.SignificanceMain.java
/** * Prints table to output string as CSV//from w w w . j av a 2 s.c o m * * @param out output * @param <T> value type * @param table table * @throws IOException */ public static <T> String tableToCsv(Table<String, String, Boolean> table) throws IOException { StringWriter sw = new StringWriter(); CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); List<String> firstRow = new ArrayList<>(); firstRow.add(" "); firstRow.addAll(table.columnKeySet()); printer.printRecord(firstRow); for (String rowKey : table.rowKeySet()) { printer.print(rowKey); for (String columnKey : table.columnKeySet()) { printer.print(table.get(rowKey, columnKey)); } printer.println(); } printer.close(); return sw.toString(); }
From source file:Main.java
/** * Returns all nodes at the bottom of path from node. * If element begins with '@', indicates an attribute, eg "@id" * The '#text' element indicates that the node has a single text child. * @param node Node to apply path to/*from ww w .java 2 s . c o m*/ * @param path Path to apply * @return All nodes at bottom of path. List may be empty but not null. */ static public List<Node> extractPaths(Node node, String[] path) { List<Node> result = new ArrayList<Node>(); result.add(node); for (int i = 0; i < path.length; i++) { List<Node> children = new ArrayList<Node>(); for (int j = 0; j < result.size(); j++) children.addAll(extractNodes((Node) result.get(j), path[i])); result = children; } return result; }
From source file:Main.java
private static <T> List<T> copyList(List<T> original) { List<T> copy = null; if (original != null) { copy = new ArrayList<T>(); if (!original.isEmpty()) { copy.addAll(original); }// w w w.j a v a 2 s .com } return copy; }
From source file:com.threerings.getdown.tools.Digester.java
/** * Creates a digest file in the specified application directory. *///from www. j av a 2s . c om public static void createDigest(File appdir) throws IOException { File target = new File(appdir, Digest.DIGEST_FILE); System.out.println("Generating digest file '" + target + "'..."); // create our application and instruct it to parse its business Application app = new Application(appdir, null); app.init(false); List<Resource> rsrcs = new ArrayList<Resource>(); rsrcs.add(app.getConfigResource()); rsrcs.addAll(app.getCodeResources()); rsrcs.addAll(app.getResources()); for (Application.AuxGroup ag : app.getAuxGroups()) { rsrcs.addAll(ag.codes); rsrcs.addAll(ag.rsrcs); } // now generate the digest file Digest.createDigest(rsrcs, target); }
From source file:Main.java
/** * Joins the items of multiple lists into one list. * /*from ww w. j a va 2 s . co m*/ * @return */ public static <GPItem> List<GPItem> joinLists(final List<List<GPItem>> lists) { if (lists.size() == 0) { return new ArrayList<GPItem>(0); } final List<GPItem> joined = new ArrayList<GPItem>(lists.size() * lists.get(0).size()); for (final List<GPItem> list : lists) { joined.addAll(list); } return joined; }
From source file:Main.java
public static <T> List<? extends T> concatSuper(List<? extends T> collection1, List<? extends T> collection2) { if (isEmpty(collection1)) { return collection2; }// w ww . jav a2s . c om if (isEmpty(collection2)) { return collection1; } List<T> result = createArrayList(collection1.size() + collection2.size()); result.addAll(collection1); result.addAll(collection2); return result; }