List of utility methods to do Iterator from
int | getMaxLength(Iterator i) calculate the maximum length of all strings in i. int max = 0; while (i.hasNext()) { String s = i.next().toString(); int c = s.length(); if (c > max) max = c; return max; ... |
double | getPerplexity(Iterator get Perplexity double sum = 0.0f; return sum; |
Iterator | getPersistentKeysIterator(HashMap hashMap) Returns an iterator for the hash map keys that is not changed by parallel changes to the hash map. return ((HashMap) hashMap.clone()).keySet().iterator();
|
String | getSigLinePastOtherAnnotations(String selfCmprurrentLine, Iterator get Sig Line Past Other Annotations while (selfCmprurrentLine.trim().startsWith("@")) { selfCmprurrentLine = line_itr.next(); return selfCmprurrentLine; |
List | getSomeElements(Iterator get Some Elements ArrayList<T> list = new ArrayList<>(); int currentAmount = 0; while (iterator.hasNext() && (currentAmount++ < limit)) { list.add(iterator.next()); return list; |
List | getSubList(Iterator iterator, int startIndex, int numberOfItems) Create a list of objects taken from the given iterator and crop the resulting list according to the startIndex and numberOfItems parameters. List croppedList = new ArrayList(numberOfItems); int skippedRecordCount = 0; int copiedRecordCount = 0; while (iterator.hasNext()) { Object object = iterator.next(); if (++skippedRecordCount <= startIndex) { continue; croppedList.add(object); if ((numberOfItems != 0) && (++copiedRecordCount >= numberOfItems)) { break; return croppedList; |
Iterator | getTypedIterator(Iterator it, Class get Typed Iterator return (Iterator<T>) it;
|
Iterator | toIterator(Enumeration Adapt an enumeration to an iterator. @SuppressWarnings("hiding") class EnumerationIterator<E> implements Iterator<E> { private Enumeration<E> enumeration; public EnumerationIterator(Enumeration<E> enumeration) { this.enumeration = enumeration; public boolean hasNext() { return this.enumeration.hasMoreElements(); ... |