List of usage examples for java.util ListIterator hasNext
boolean hasNext();
From source file:edu.cornell.mannlib.vitro.webapp.utils.developer.loggers.StackTraceUtility.java
private void removeJenaClassesFromStackTrace(List<StackTraceElement> list) { ListIterator<StackTraceElement> iter = list.listIterator(); while (iter.hasNext()) { StackTraceElement ste = iter.next(); if (ste.getClassName().startsWith("com.hp.hpl.jena.")) { iter.remove();/*from w w w. jav a2 s. c o m*/ } } }
From source file:edu.cornell.mannlib.vitro.webapp.utils.developer.loggers.StackTraceUtility.java
private void trimStackTraceAtBeginning(List<StackTraceElement> list) { ListIterator<StackTraceElement> iter = list.listIterator(); while (iter.hasNext()) { StackTraceElement ste = iter.next(); if (ste.getClassName().equals(lowestClassInStackTrace.getName())) { break; } else {/*from ww w . j av a 2s . c o m*/ iter.remove(); } } }
From source file:net.erdfelt.android.sdkfido.project.SourceCopier.java
public void identifyCopiedFiles(Dir sourceDir) throws IOException { if (javalisting == null) { return; // nothing to do here }//w ww .j av a 2 s . c om File searchFile; String javafilename; ListIterator<String> iterlisting = javalisting.listIterator(); while (iterlisting.hasNext()) { javafilename = iterlisting.next(); searchFile = sourceDir.getFile(javafilename); if (searchFile.exists()) { iterlisting.remove(); out.println("[FOUND] " + javafilename); } } }
From source file:ListOfLists.java
public int indexOf(Object o) { ListIterator e = listIterator(); if (o == null) { while (e.hasNext()) { if (e.next() == null) return e.previousIndex(); }/*w w w .j ava2 s. c o m*/ } else { Object el; while (e.hasNext()) { el = e.next(); if (el.equals(o)) return e.previousIndex(); } } return -1; }
From source file:org.jasig.i18n.translate.AutoTranslationService.java
public Map<String, String> getAutoUpdatedTranslationMap(Map<String, String> mainMap, Map<String, String> targetMap, String languageKey) { // assemble a set of keys represented in the main map but not in the // target language map Set<String> missing = mainMap.keySet(); missing.removeAll(targetMap.keySet()); // put the keys in a list so that we have a consistent ordering List<String> keys = new ArrayList<String>(); keys.addAll(missing);// ww w . j ava2s.c o m // assemble a list of untranslated messages in the same order as our // missing key list List<String> untranslatedMessages = new ArrayList<String>(); for (String key : keys) { untranslatedMessages.add(mainMap.get(key)); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("key", this.apiKey); parameters.put("source", this.defaultLanguageKey); parameters.put("target", languageKey); parameters.put("query", untranslatedMessages); GoogleTranslationResponse response = this.restTemplate.getForObject(urlTemplate, GoogleTranslationResponse.class, parameters); List<Translation> translations = response.getTranslations(); // iterate through the auto-translations, adding each to the target // map ListIterator<Translation> iter = translations.listIterator(); while (iter.hasNext()) { Translation translation = iter.next(); String key = keys.get(iter.previousIndex()); targetMap.put(key, translation.getTranslatedText()); } return targetMap; }
From source file:edu.cuny.util.SortedTreeList.java
@Override public String toString() { String s = " ["; final ListIterator<E> iterator = listIterator(); while (iterator.hasNext()) { s += iterator.next() + " "; }//from w w w . ja v a2 s . co m s += "] "; return "(" + name + ", " + s + " size: " + size() + ")"; }
From source file:vteaexploration.plottools.panels.DefaultExplorationPanel.java
protected int keyLookUp(int x, int y, int l) { ListIterator<ArrayList> itr = ExplorationItems.listIterator(); Object test;/*from w w w .ja v a 2 s .c o m*/ String key = x + "_" + y + "_" + l; while (itr.hasNext()) { //test = itr.next().get(0); ArrayList list = itr.next(); test = list.get(0); if (key.equals(test.toString())) { return ExplorationItems.indexOf(list); } } return 0; }
From source file:net.alchemiestick.katana.winehqappdb.Metrics.java
private void removeNamedData(String name) { ListIterator<NameValuePair> itr = webData.listIterator(); while (itr.hasNext()) { NameValuePair t = itr.next(); if (t.getName() == name) { itr.remove();/*ww w . j a v a2 s. c o m*/ return; } } }
From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaSearchQueryOptions.java
private List<Individual> removeSubjectUri(List<Individual> individuals, String subjectUri) { ListIterator<Individual> it = individuals.listIterator(); while (it.hasNext()) { Individual ind = it.next();//from w ww . java 2s . c o m if (ind.getURI().equals(subjectUri)) { it.remove(); } } return individuals; }
From source file:es.uvigo.ei.sing.adops.operations.running.mrbayes.MrBayes3_2ProcessManager.java
@Override public void buildSummary(MrBayesOutput output) throws OperationException { try {/* ww w. j ava2 s . co m*/ FileUtils.moveFile(new File(output.getConFile().getAbsolutePath() + ".tre"), output.getConFile()); final List<String> lines = FileUtils.readLines(output.getConFile()); final ListIterator<String> itLines = lines.listIterator(); while (itLines.hasNext()) { final String line = itLines.next(); if (line.contains("tree con_50_majrule")) { final String[] lineSplit = line.split("="); final String tree = lineSplit[1].trim(); itLines.set(lineSplit[0] + "= " + Newick.parse(tree.trim())); } } FileUtils.writeLines(output.getConFile(), lines); super.buildSummary(output); } catch (Exception e) { throw new OperationException("Error while working with consensus tree", e); } }