the iterator(method of class nodepositionlist position iterators for adts that support the notion of positionsuch as the list and sequence adtswe can also provide the following methodpositions()return an iterable object (like an array list or node listcontaining the positions in the collection as elements an iterator returned by this method allows us to loop through the positions of list to guarantee that node list supports this methodwe could add it to the positionlist interfaceas shown in code fragment then we couldfor exampleadd an implementation of this method to the nodepositionlistas shown in code fragment this method uses the nodepositionlist class itself to create list that contains the positions of the original list as its elements returning this list of positions as our iterable object allows us to