List of usage examples for java.util List addAll
boolean addAll(Collection<? extends E> c);
From source file:io.atomix.core.tree.DocumentPath.java
/** * Creates a new root {@code DocumentPath} from a list of path elements. * * @param elements path elements/*from w w w . j a v a 2s .co m*/ * @return {@code DocumentPath} instance */ public static DocumentPath from(List<String> elements) { List<String> copy = new ArrayList<>(); copy.add(ROOT_ELEMENT); copy.addAll(elements); return new DocumentPath(copy); }
From source file:io.atomix.core.tree.DocumentPath.java
/** * Creates a new root {@code DocumentPath} from a list of path elements. * * @param elements path elements/* ww w . j a v a 2s. c om*/ * @param child child element * @return {@code DocumentPath} instance */ public static DocumentPath from(List<String> elements, String child) { List<String> copy = new ArrayList<>(); copy.add(ROOT_ELEMENT); copy.addAll(elements); copy.add(child); return new DocumentPath(copy); }
From source file:at.pcgamingfreaks.Version.java
private static List<String> getAll(String[] source, String[] searchForArray) { List<String> result = new LinkedList<>(); for (String searchFor : searchForArray) { result.addAll(StringUtils.getAllContainingIgnoreCase(source, searchFor)); }/* w ww . jav a 2s .c o m*/ return result; }
From source file:com.spotify.docker.CompositeImageName.java
/** * An image name can be a plain image name or in the composite format <name>:<tag> and * this factory method makes sure that we get the plain image name as well as all the desired tags * for an image, including any composite tag. *///from w w w . j ava 2 s . c om static CompositeImageName create(final String imageName, final List<String> imageTags) throws MojoExecutionException { final String name = StringUtils.substringBeforeLast(imageName, ":"); if (StringUtils.isBlank(name)) { throw new MojoExecutionException("imageName not set!"); } final List<String> tags = new ArrayList<>(); final String tag = StringUtils.substringAfterLast(imageName, ":"); if (StringUtils.isNotBlank(tag)) { tags.add(tag); } if (imageTags != null) { tags.addAll(imageTags); } if (tags.size() == 0) { throw new MojoExecutionException("No tag included in imageName and no imageTags set!"); } return new CompositeImageName(name, tags); }
From source file:ca.phon.media.util.MediaLocator.java
/** * Search for a file in the media include path. * /* w w w .j av a 2s .c om*/ * Will look in the project resource directory first if * project is not null. * * @param filename * @param project (may be <code>null</code>) * @param corpus (may be <code>null</code>) * @return the file object for the file or null if not found */ public static File findMediaFile(String filename, Project project, String corpus) { File retVal = null; if (filename == null) return retVal; // do we already have an absolute path final File mediaFile = new File(filename); if (mediaFile.isAbsolute()) { retVal = mediaFile; } else { /* * Look for media in the following location order: * * <media folder>/<project>/<corpus>/<file> * <media folder>/<project>/<file> * <media folder>/<corpus>/<file> * <media folder>/<file> */ final List<String> checkList = new ArrayList<String>(); if (project != null && corpus != null) { checkList.add(project.getName() + File.separator + corpus + File.separator + filename); } if (project != null) { checkList.add(project.getName() + File.separator + filename); } if (corpus != null) { checkList.add(corpus + File.separator + filename); } checkList.add(File.separator + filename); final List<String> mediaPaths = new ArrayList<String>(); mediaPaths.addAll(getMediaIncludePaths()); if (project != null) { // check resources File resFile = new File(project.getResourceLocation()); File resMediaFile = new File(resFile, "media"); mediaPaths.add(0, resMediaFile.getAbsolutePath()); } // look in rest of search paths for (String path : mediaPaths) { for (String checkName : checkList) { final File checkFile = new File(path, checkName); if (checkFile.exists()) { retVal = checkFile; break; } } } } return retVal; }
From source file:Main.java
public static void removeDuplicateWithOrder(List arlList) { Set set = new HashSet(); List newList = new ArrayList(); for (Iterator iter = arlList.iterator(); iter.hasNext();) { Object element = iter.next(); if (set.add(element)) newList.add(element);// w w w . j ava2 s . c o m } arlList.clear(); arlList.addAll(newList); }
From source file:org.jetbrains.webdemo.executors.JunitExecutor.java
private static List<Class> getAllClassesFromTheDir(File directory) { List<Class> classes = new ArrayList<Class>(); String prefix = ""; for (File file : directory.listFiles()) { if (file.isDirectory()) { classes.addAll(getAllClassesFromTheDir(file, prefix)); } else {// w w w .j a v a 2 s .co m if (file.getName().endsWith(".class")) { try { classes.add(Class.forName( prefix + file.getName().substring(0, file.getName().length() - ".class".length()))); } catch (ClassNotFoundException e) { } } } } return classes; }
From source file:com.amalto.core.initdb.InitDBUtil.java
private static void parseInitMap(InputStream in, DocumentBuilder builder, Map<String, List<String>> initMap) throws Exception { Document doc = builder.parse(in); NodeList nodelist = doc.getElementsByTagName("item"); //$NON-NLS-1$ for (int i = 0; i < nodelist.getLength(); i++) { Node node = nodelist.item(i); NodeList list = node.getChildNodes(); String name = null;//from ww w .j a v a 2 s.co m for (int j = 0; j < list.getLength(); j++) { Node n = list.item(j); if (n instanceof Element) { if ("name".equals(n.getNodeName())) { //$NON-NLS-1$ name = n.getTextContent(); if (initMap.get(name) == null) { initMap.put(name, new ArrayList<String>()); } } if ("list".equals(n.getNodeName())) { //$NON-NLS-1$ if (n.getTextContent() == null || n.getTextContent().trim().length() == 0) { continue; } List<String> lists = initMap.get(name); String[] arr = n.getTextContent().split(";"); //$NON-NLS-1$ lists.addAll(Arrays.asList(arr)); } } } } }
From source file:com.sugaronrest.restapicalls.ModuleInfo.java
public static Iterable<Field> getFieldsUpTo(Class<?> type, Class<?> exclusiveParent) { List<Field> currentClassFields = new ArrayList<>(); currentClassFields.addAll(Arrays.asList(type.getDeclaredFields())); Class<?> parentClass = type.getSuperclass(); if (parentClass != null && (exclusiveParent == null || !parentClass.equals(exclusiveParent))) { List<Field> parentClassFields = (List<Field>) getFieldsUpTo(parentClass, exclusiveParent); currentClassFields.addAll(parentClassFields); }//w w w. j a va2s .c o m return currentClassFields; }
From source file:com.l2jfree.gameserver.document.DocumentEngine.java
public static List<L2Skill> loadSkills() { final List<L2Skill> list = new ArrayList<L2Skill>(); for (File file : listFiles("data/stats/skills")) { DocumentSkill doc = new DocumentSkill(file); doc.parse();/* w w w .ja va 2 s . c o m*/ list.addAll(doc.getSkills()); } return list; }