tag:blogger.com,1999:blog-4035567729001522718.post2786858647657537788..comments2022-10-02T04:30:17.851+05:30Comments on Char Sequence: Fun with Iterators - UnionIteratorShantanu Kumarhttp://www.blogger.com/profile/05850495396182844220noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4035567729001522718.post-67166335899425706162009-10-01T23:45:22.876+05:302009-10-01T23:45:22.876+05:30<E> is a generic parameter by itself -- I am...<E> is a generic parameter by itself -- I am not sure how "? extends E" can be useful.<br /><br />Var-args factory method is a good idea. (Item #1 in "Effective Java" by Joshua Bloch says consider using factory methods instead of constructors, which applies here because Collections are not the only iterable things.)<br /><br />I have updated the code. Thanks.Shantanu Kumarhttps://www.blogger.com/profile/05850495396182844220noreply@blogger.comtag:blogger.com,1999:blog-4035567729001522718.post-55630956451624977702009-10-01T16:51:29.406+05:302009-10-01T16:51:29.406+05:30You probably should use Iterator[Iterator[? extend...You probably should use Iterator[Iterator[? extends E]] instead of Iterator[? extends Iterator[E]] so that this class could be used to iterate collections that do not have exactly the same generic types.<br /><br />What is more a constructor taking (Collection[? extends E]... collections) would be more useful.<br /><br />(sorry for using square brackets - your blog confuses generics with html injection :D )Anonymousnoreply@blogger.com