List of utility methods to do ListIterator Usage
void | retainAll(final List> list, final Collection retain All final ListIterator<?> it = list.listIterator(); while (it.hasNext()) { final int index = it.nextIndex(); it.next(); if (indices.contains(index)) { } else { it.remove(); |
void | rewindIterator(@SuppressWarnings("rawtypes") ListIterator it, int n) rewind Iterator for (int i = 0; i < n; i++) { it.previous(); |
List | sort(List aList) Sort List argument - natural order List results = null; if (aList != null) { results = new ArrayList(); Object[] array = aList.toArray(); Arrays.sort(array); List list = Arrays.asList(array); ListIterator listIterator = list.listIterator(); while (listIterator.hasNext()) { ... |
List | stringCrossJoin(List string Cross Join assert candidates != null; assert candidates.isEmpty() == false; List<String> results = new ArrayList<>(); Iterator<Set<String>> iter = candidates.iterator(); assert iter.hasNext(); results.addAll(iter.next()); while (iter.hasNext()) { Set<String> next = iter.next(); ... |
List | stringToList(String commas) Splits a string with commas in it into a string List. List<String> list = new ArrayList<String>(); ListIterator<String> iterator = Arrays.asList(commas.split("\\s*,\\s*")).listIterator(); if (iterator != null) { while (iterator.hasNext()) { list.add(iterator.next()); } else list = Arrays.asList(commas); ... |
List | stripQuotes(List strip Quotes input = new ArrayList<>(input); ListIterator<String> iterator = input.listIterator(); while (iterator.hasNext()) { String value = iterator.next(); if (!(value.length() >= 3)) { continue; if (value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"') { ... |
double[] | toArray(List to Array double[] result = new double[a.size()]; for (int i = 0; i < a.size(); i++) { result[i] = a.get(i); return result; |
Object | toCFML(Object obj) to CFML if (obj instanceof Map) return toCFML((Map) obj); if (obj instanceof List) return toCFML((List) obj); return obj; |
char[][] | toCharArrays(List to Char Arrays char[][] charArrays = new char[strings.size()][]; for (ListIterator<String> it = strings.listIterator(); it.hasNext();) { int index = it.nextIndex(); charArrays[index] = it.next().toCharArray(); return charArrays; |
int | toInt(final List to Int int pos = 1; int retVal = 0; for (ListIterator<Integer> it = digits.listIterator(digits.size()); it.hasPrevious();) { retVal += it.previous() * pos; pos = pos * base; return retVal; |