Type safe flattening of nested sets / structures in Java
I want to smooth the collection / structure of some T-class elements nested arbitrarily deep in Java
>Only live views, not copied collections; > Not only deal with sets, but also iterators, arrays of T in any dimension, iteratable and all these structures are arbitrarily mixed and nested; > Static safety
Is there a Java library that can handle this?
Guava seems to handle only one nesting level, namely collection < collection < T > > – flat – > collection and lt; T> ;.
Lambdaj looks promising: can it be implemented in some way by combining on (), asitrator (), and flatteniterator ()? In a statically safe way?
Solution
Guava may eventually support this:
http://code.google.com/p/guava-libraries/issues/detail?id=174
(it's probably the easiest to read from bottom to top because its mind has shifted several times in his life.)