/** Returns all lines remaining in this iterator as a list. * * @return all lines remaining in this iterator as a list. */ public List<MutableString> allLines() { final ObjectArrayList<MutableString> result = new ObjectArrayList<MutableString>(); while( hasNext() ) result.add( next().copy() ); return result; } }
/** Returns all lines remaining in this iterator as a list. * * @return all lines remaining in this iterator as a list. */ public List<MutableString> allLines() { final ObjectArrayList<MutableString> result = new ObjectArrayList<MutableString>(); while( hasNext() ) result.add( next().copy() ); return result; } }
/** Returns all lines remaining in this iterator as a list. * * @return all lines remaining in this iterator as a list. */ public List<MutableString> allLines() { final ObjectArrayList<MutableString> result = new ObjectArrayList<>(); while(hasNext()) result.add(next().copy()); return result; } }
/** * Obtain the next selectedIndex from prediction line that is strictly larger than currentIndex. * If predictionLine is null (option -p was not given), return currentIndex. * * @param predictionLine * @param selectedIndex * @param currentIndex * @return */ private int getNextIndex(LineIterator predictionLine, int selectedIndex, int currentIndex) { if (predictionLine == null) return currentIndex; if (selectedIndex >= currentIndex) { return selectedIndex; } while (selectedIndex < currentIndex && predictionLine.hasNext()) { // find the next selected index in the prediction file. MutableString line = predictionLine.next(); if (line.startsWith("index")) continue; int tabIndex = line.indexOf('\t'); if (tabIndex == -1) { tabIndex = line.length(); } if (tabIndex > 0) { selectedIndex = Integer.parseInt(line.subSequence(0, tabIndex).toString()); } } return selectedIndex; }