org.apache.pivot.io
Class FileList

java.lang.Object
  extended by org.apache.pivot.collections.adapter.ListAdapter<File>
      extended by org.apache.pivot.io.FileList
All Implemented Interfaces:
Serializable, Iterable<File>, Collection<File>, List<File>, Sequence<File>

public class FileList
extends ListAdapter<File>

Collection representing a list of files. Each entry in the list is unique; i.e. a single file can't be added to the list more than once.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.List
List.ItemIterator<T>, List.ListListenerList<T>
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
 
Constructor Summary
FileList()
           
FileList(List<File> files)
           
 
Method Summary
 int add(File file)
          Adds an item to the list.
 void insert(File file, int index)
          Inserts an item into the list.
 void setComparator(Comparator<File> comparator)
          Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.
 File update(int index, File file)
          Updates the item at the given index.
 
Methods inherited from class org.apache.pivot.collections.adapter.ListAdapter
clear, get, getComparator, getLength, getList, getListListeners, indexOf, isEmpty, iterator, remove, remove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileList

public FileList()

FileList

public FileList(List<File> files)
Method Detail

add

public int add(File file)
Description copied from interface: List
Adds an item to the list. If the list is unsorted, the item is appended to the end of the list. Otherwise, it is inserted at the appropriate index.

Specified by:
add in interface List<File>
Specified by:
add in interface Sequence<File>
Overrides:
add in class ListAdapter<File>
Parameters:
file - The item to be added to the sequence.
Returns:
The index at which the item was added.
See Also:
ListListener.itemInserted(List, int)

insert

public void insert(File file,
                   int index)
Description copied from interface: List
Inserts an item into the list.

Specified by:
insert in interface List<File>
Specified by:
insert in interface Sequence<File>
Overrides:
insert in class ListAdapter<File>
Parameters:
file - The item to be added to the list.
index - The index at which the item should be inserted. Must be a value between 0 and getLength().
See Also:
ListListener.itemInserted(List, int)

update

public File update(int index,
                   File file)
Description copied from interface: List
Updates the item at the given index.

Specified by:
update in interface List<File>
Specified by:
update in interface Sequence<File>
Overrides:
update in class ListAdapter<File>
Parameters:
index - The index of the item to update.
file - The item that will replace any existing value at the given index.
Returns:
The item that was previously stored at the given index.
See Also:
ListListener.itemUpdated(List, int, Object)

setComparator

public void setComparator(Comparator<File> comparator)
Description copied from interface: Collection
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.

Calling this method more than once with the same comparator will re-sort the collection.

Specified by:
setComparator in interface Collection<File>
Specified by:
setComparator in interface List<File>
Overrides:
setComparator in class ListAdapter<File>
Parameters:
comparator - The comparator used to order elements in the collection, or null if the collection is unsorted.
See Also:
ListListener.comparatorChanged(List, Comparator)