S
Safalra
I'm currently in the process of 'generifying' my old functional list
classes before putting them on my website (in case someone wants to use
inefficient functional-style lists instead of efficient
imperative-style lists...). Everything has worked well, except for one
line. The 'truncate' method of my LazyList class creates an Iterator
using an inner class. The inner class accesses its outer class instance
through LazyList.this (in order to take the 'tail' repeatedly), but the
compiler gives this bizarre error message:
safalra\functional\LazyList.java:213: incompatible types
found : safalra.functional.LazyList<T>
required: safalra.functional.LazyList<T>
If I change the inner class variable in which I'm storing the remainder
of the list (which is initially the outer class instance) to type
LazyList (rather than LazyList<T>) the compiler doesn't object to the
assignment, but then of course the 'tail' is no longer of type
LazyList<T>.
For the moment I'm working around this by passing 'this' as a parameter
to the constructor of the inner class, but this is distinctly
inelegant. Does anybody know what is causing this problem?
classes before putting them on my website (in case someone wants to use
inefficient functional-style lists instead of efficient
imperative-style lists...). Everything has worked well, except for one
line. The 'truncate' method of my LazyList class creates an Iterator
using an inner class. The inner class accesses its outer class instance
through LazyList.this (in order to take the 'tail' repeatedly), but the
compiler gives this bizarre error message:
safalra\functional\LazyList.java:213: incompatible types
found : safalra.functional.LazyList<T>
required: safalra.functional.LazyList<T>
If I change the inner class variable in which I'm storing the remainder
of the list (which is initially the outer class instance) to type
LazyList (rather than LazyList<T>) the compiler doesn't object to the
assignment, but then of course the 'tail' is no longer of type
LazyList<T>.
For the moment I'm working around this by passing 'this' as a parameter
to the constructor of the inner class, but this is distinctly
inelegant. Does anybody know what is causing this problem?