// Textbook fragment 06.17 /** Returns an iterable collection of all the nodes in the list. */ public Iterable> positions() { // create a list of posiitons PositionList> P = new NodePositionList>(); if (!isEmpty()) { Position p = first(); while (true) { P.addLast(p); // add position p as the last element of list P if (p == last()) break; p = next(p); } } return P; // return P as our Iterable object }