Package org.apache.pivot.io
Class FileList
- java.lang.Object
-
- org.apache.pivot.collections.adapter.ListAdapter<java.io.File>
-
- org.apache.pivot.io.FileList
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<java.io.File>
,Collection<java.io.File>
,List<java.io.File>
,Sequence<java.io.File>
public class FileList extends ListAdapter<java.io.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>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
add(java.io.File file)
Adds an item to the list.void
insert(java.io.File file, int index)
Inserts an item into the list.void
setComparator(java.util.Comparator<java.io.File> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.java.io.File
update(int index, java.io.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
-
-
-
-
Method Detail
-
add
public int add(java.io.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 interfaceList<java.io.File>
- Specified by:
add
in interfaceSequence<java.io.File>
- Overrides:
add
in classListAdapter<java.io.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
@UnsupportedOperation public void insert(java.io.File file, int index)
Description copied from interface:List
Inserts an item into the list.- Specified by:
insert
in interfaceList<java.io.File>
- Specified by:
insert
in interfaceSequence<java.io.File>
- Overrides:
insert
in classListAdapter<java.io.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 between0
andgetLength()
.- See Also:
ListListener.itemInserted(List, int)
-
update
@UnsupportedOperation public java.io.File update(int index, java.io.File file)
Description copied from interface:List
Updates the item at the given index.- Specified by:
update
in interfaceList<java.io.File>
- Specified by:
update
in interfaceSequence<java.io.File>
- Overrides:
update
in classListAdapter<java.io.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
@UnsupportedOperation public void setComparator(java.util.Comparator<java.io.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 interfaceCollection<java.io.File>
- Specified by:
setComparator
in interfaceList<java.io.File>
- Overrides:
setComparator
in classListAdapter<java.io.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)
-
-