Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why doesn Iterator extend Enumeration?

enumeration EXTEND iterator
0
Posted

Why doesn Iterator extend Enumeration?

0

We view the method names for Enumeration as unfortunate. They’re very long, and very frequently used. Given that we were adding a method and creating a whole new framework, we felt that it would be foolish not to take advantage of the opportunity to improve the names. Of course we could support the new and old names in Iterator, but it doesn’t seem worthwhile. • Why don’t you provide an Iterator.peek method that allows you to look at the next element in an iteration without advancing the iterator? It can be implemented atop the current Iterators (a similar pattern to java.io.PushbackInputStream). We believe that its use would be rare enough that it isn’t worth including in the interface that everyone has to implement.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.