org.inria.ns.reflex.util
Interface DynamicList

All Superinterfaces:
Collection, Iterable, List
All Known Implementing Classes:
DynamicList.AbstractCompleted, DynamicList.Completed, DynamicList.Impl, GroupFunction.OuterList

public interface DynamicList
extends List

A DynamicList is a kind of list for which its items are added while iterating on it.

Such a list may have a size of -1, which indicates that the items are not yet known. Getting a size of -1 doesn't denote that its iterators will be empty. If the iterator has not been completed, its size may grow as one goes along.

Several iterators may be built safely from this list : the first iterator is not necessary those that must retrieve all the items of the list. If an iterator is used to browse items more quickly than another of the same list that was get before, it must be used to complete the items of the list.

*** Singletons that are unwrapped automatically from lists must not be unwrapped from DynamicList, even when completed. ***

Author:
Philippe Poulard

Nested Class Summary
static class DynamicList.AbstractCompleted
          A completed abstract dynamic list, that is to say a list that prevent singletons from unwrapping.
static class DynamicList.Completed
          A completed dynamic list, that is to say a list that prevent singletons from unwrapping.
static class DynamicList.Impl
          A dynamic list backed by an iterator.
 
Method Summary
 boolean completed()
          Return true if all the items of this list have been added, false otherwise.
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Method Detail

completed

boolean completed()
Return true if all the items of this list have been added, false otherwise.

Once completed, the size gives the effective number of items in this list.

Returns:
true if no more items will be added to this list by the underlying iterator, false otherwise.