Position ADT
Let's revisit the Position
interface:
/**
* Generic position interface.
*
* @param <T> the element type.
*/
public interface Position<T> {
/**
* Read element from this position.
*
* @return element at this position.
*/
T get();
}
Recall we have created this abstraction to protect the Node
class.
All operations of the List ADT receive/return Position but internally a position is casted into a node.