Il Javadoc per ListIterator dice:
A
ListIteratorhas no current element; its cursor position always lies between the element that would be returned by a call toprevious()and the element that would be returned by a call tonext().
Perché la ListIterator di Java è stata implementata per puntare tra gli elementi anziché su un elemento corrente? Sembra che questo renda il codice client meno leggibile quando deve chiamare ripetutamente getNext() , getPrevious() , quindi presumo che ci debba essere una buona ragione per la scelta.
Come nota a margine, ho appena scritto una piccola libreria chiamata peekable-arraylist che estende ArrayList , Iterator e ListIterator che fornisce metodi peekAtNext() e peekAtPrevious() implementati come:
@Override public synchronized T peekAtNext() {
T t = next();
previous();
return t;
}