Design pattern for adding / removing elements
Posted
by
de3
on Stack Overflow
See other posts from Stack Overflow
or by de3
Published on 2010-12-24T08:46:25Z
Indexed on
2010/12/24
8:54 UTC
Read the original article
Hit count: 257
Wikipedia's definition for Iterator pattern design: the Iterator pattern is a design pattern in which iterators are used to access the elements of an aggregate object sequentially without exposing its underlying implementation.
Iterator interface in java provides the following methods
- hasNext()
- next()
- remove()
Is there a pattern design, or a java interface for inserting / deleting elements, and getting length of the aggregate object, in addition to iterating them? I know remove() is an optional method that can be used once per call to next(), but I am implementing a circular FIFO array and need a method delete() independent of iterator's next().
© Stack Overflow or respective owner