List of utility methods to do ListIterator Usage
List
| overlap(List
Introduces overlap into a series of lists. if (before < 0) { throw new IllegalArgumentException("Value of before cannot be negative"); if (after < 0) { throw new IllegalArgumentException("Value of after cannot be negative"); ListIterator<List<T>> iter = lists.listIterator(); List<List<T>> result = new ArrayList<List<T>>(); ... |
String[] | parsePath(String sPath) Parses the XPath expression in a string array containing the XPath elements. if (sPath.indexOf("//") >= 0) { throw new IllegalArgumentException("Destination path cannot have wild-cards."); List<String> lElemList = new LinkedList<String>(Arrays.asList(sPath.split("/"))); for (ListIterator<String> iIter = lElemList.listIterator(); iIter.hasNext();) { String sElem = iIter.next(); if (sElem.equals(".")) { throw new IllegalArgumentException("Destination path cannot have wild-cards."); ... |
void | partialSort(List partial Sort Object[] a = list.toArray(); partialSort(a, numTop, (Comparator) c); ListIterator<T> i = list.listIterator(); for (int j = 0; j < a.length; j++) { i.next(); i.set((T) a[j]); |
E | peekNext(ListIterator peek Next E e = null; if (it.hasNext()) { e = it.next(); it.previous(); return e; |
T | peekNext(ListIterator peek Next T next = iterator.next();
iterator.previous();
return next;
|
void | print(final List> concatenatables)final ListIterator<?> iterator = concatenatables.listIterator(); System.out.print(" ==== "); while (iterator.hasNext()) { final Object a = iterator.next(); System.out.print(a); if (iterator.hasNext()) System.out.print(" x "); System.out.println(); |
List | removeCustomFilters(List remove Custom Filters List<String> mentions = new ArrayList<String>(); ListIterator<String> filterIterator = filters.listIterator(); while (filterIterator.hasNext()) { String[] filterSplit = filterIterator.next().split(":"); if (filterSplit[1].equals("in") && filterSplit[0].equals("mentions")) { mentions.add(filterSplit[2]); filterIterator.remove(); return mentions; |
List | removeDuplicates(List Keeps and returns the original list. HashSet<T> set = new HashSet<T>(list.size()); ListIterator<T> i = list.listIterator(); while (i.hasNext()) { T cur = i.next(); if (set.contains(cur)) { i.remove(); } else { set.add(cur); ... |
void | removeStartsWith(String prefix, List remove Starts With ListIterator<String> it = lines.listIterator(); while (it.hasNext()) { String line = it.next(); if (line.startsWith(prefix)) { it.remove(); |
ListIterator | reset(ListIterator iterator) reset while (iterator.hasPrevious()) { iterator.previous(); return iterator; |