List of usage examples for java.util LinkedList LinkedList
public LinkedList()
From source file:Ch5Undoable.java
public Ch5Undoable(Composite parent) { super(parent, SWT.NONE); undoStack = new LinkedList(); redoStack = new LinkedList(); buildControls();// ww w . j a v a2 s.c o m }
From source file:asciidoc.maven.plugin.cmd.A2x.java
@Override public LinkedList<String> getOptions() { LinkedList<String> options = new LinkedList<String>(); if (stylesheet != null) options.add("--stylesheet=" + this.stylesheet); if (this.icons) { options.add("--icons"); options.add("--icons-dir=" + this.iconsDir); }/*from w ww . jav a 2 s . c o m*/ if (this.verbose) { options.add("--verbose"); } options.add("-f" + this.format); if (this.traductor != null) { options.add("--" + this.traductor); } if (this.book) options.add("-dbook"); if (this.encoding != null) options.add("-a encoding=" + this.encoding); if (this.lang != null) options.add("-a lang=" + this.lang); options.add("-D" + getOutput().getAbsolutePath()); options.add(this.srcFile.getAbsolutePath()); return options; }
From source file:com.hoiio.sdk.util.StringUtil.java
/** * Converts the {@code Map} to URL encoded {@code String} * @param map {@code Map<String, String>} * @return The encoded URL {@code String} *//* w ww . ja va 2s .c o m*/ public static String convertMapToUrlEncodedString(Map<String, String> map) { if (map == null) { return ""; } List<NameValuePair> qparams = new LinkedList<NameValuePair>(); for (Entry<String, String> item : map.entrySet()) { if (item.getValue() != null) qparams.add(new BasicNameValuePair(item.getKey(), item.getValue())); } return URLEncodedUtils.format(qparams, "UTF-8"); }
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. * @throws NotDirectoryException The given path was not a directory. *///from ww w .java2 s. c o m public static LinkedList<Mp3FileAdvanced> mp3InDirectory(Path path) throws NotDirectoryException { if (!Files.isDirectory(path)) throw new NotDirectoryException("The chosen path does not represent a directory"); LinkedList<Mp3FileAdvanced> list = new LinkedList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(path, "*.mp3")) { for (Path entry : stream) { // if(!entry.startsWith(".")) list.add(new Mp3FileAdvanced(entry.toFile())); } } catch (IOException | UnsupportedTagException | InvalidDataException e) { e.printStackTrace(); } return list; }
From source file:com.frostwire.android.MediaScanner.java
private static void scanFiles(final Context context, List<String> paths, int retries) { if (paths.size() == 0) { return;//from w w w .ja va 2 s .c o m } LOG.info("About to scan files n: " + paths.size() + ", retries: " + retries); final LinkedList<String> failedPaths = new LinkedList<>(); final CountDownLatch finishSignal = new CountDownLatch(paths.size()); MediaScannerConnection.scanFile(context, paths.toArray(new String[0]), null, (path, uri) -> { try { boolean success = true; if (uri == null) { success = false; failedPaths.add(path); } else { // verify the stored size four faulty scan long size = getSize(context, uri); if (size == 0) { LOG.warn("Scan returned an uri but stored size is 0, path: " + path + ", uri:" + uri); success = false; failedPaths.add(path); } } if (!success) { LOG.info("Scan failed for path: " + path + ", uri: " + uri); } } finally { finishSignal.countDown(); } }); try { finishSignal.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { // ignore } if (failedPaths.size() > 0 && retries > 0) { // didn't want to do this, but there is a serious timing issue with the SD // and storage in general SystemClock.sleep(2000); scanFiles(context, failedPaths, retries - 1); } }
From source file:ca.uviccscu.lp.persistence.GamelistStorage.java
public static synchronized List getAllGames() { List ll = new LinkedList(); Collection c = stringToGameMap.values(); ll.addAll(c);//from www . j a va 2s . com return ll; }
From source file:com.insightml.utils.jobs.ThreadedClient.java
@Override protected <O> Collection<O> execute(final Iterable<IJob<O>> jobs) { final List<O> values = new LinkedList<>(); for (final Pair<IJob<O>, O> val : new Threaded<IJob<O>, O>() { @Override//from ww w .j ava 2s . c o m protected O exec(final int i, final IJob<O> input) throws Exception { return input.run(); } }.run(jobs, 1)) { values.add(val.getSecond()); } return values; }
From source file:io.github.retz.web.ClientHelper.java
public static List<Job> running(Client c) throws IOException { List<Job> jobs = new LinkedList<>(); Response res = c.list(Job.JobState.STARTING, Optional.empty()); jobs.addAll(((ListJobResponse) res).jobs()); res = c.list(Job.JobState.STARTED, Optional.empty()); jobs.addAll(((ListJobResponse) res).jobs()); return jobs;//w ww . j a v a 2s. c o m }
From source file:Main.java
public static List<Element> getAllElementsWithAttrId(final Element element, final String namespace) { List<Element> list = new LinkedList<Element>(); if (elementHasId(element, namespace)) { list.add(element);//from w w w . j ava2 s .c om } NodeList children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child instanceof Element == false) { continue; } addAllElementsWithAttrId(list, (Element) child, namespace); } return list; }
From source file:com.thinkbiganalytics.metadata.jpa.support.QueryDslPathInspector.java
/** * for a given path (separated by dot) get the final object * * @param basePath the object to start inspecting example: QJpaBatchJobExecution jpaBatchJobExecution * @param fullPath a string representing the path you wish to inspect. example: jobInstance.jobName * @return return the Object for the path. example: will return the StringPath jobName on the QJpaBatchJobInstance class *//*from w ww.jav a 2s . com*/ public static Object getFieldObject(BeanPath basePath, String fullPath) throws IllegalAccessException { LinkedList<String> paths = new LinkedList<>(); paths.addAll(Arrays.asList(StringUtils.split(fullPath, "."))); return getFieldObject(basePath, paths); }