When you define your inner class, LinkedList2Iterator , you have shared it with another parameter of type <T> . That <T> does not match <T> from the outer class LinkedList2 .
private class LinkedList2Iterator<T> implements Iterator<T> {
You don't need to declare another <T> here, just use the <T> from the outer class, which is still in scope:
private class LinkedList2Iterator implements Iterator<T> {
rgettman
source share