pivot.io
Class FileList
java.lang.Object
pivot.collections.adapter.ListAdapter<java.io.File>
pivot.io.FileList
- All Implemented Interfaces:
- 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.
- Author:
- gbrown
Method Summary |
int |
add(java.io.File file)
Adds an item to the list. |
int |
add(Folder folder)
|
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 pivot.collections.adapter.ListAdapter |
clear, get, getComparator, getLength, getList, getListListeners, indexOf, iterator, remove, remove, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FileList
public FileList()
FileList
public FileList(java.util.List<java.io.File> files)
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 interface List<java.io.File>
- Specified by:
add
in interface Sequence<java.io.File>
- Overrides:
add
in class ListAdapter<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)
add
public int add(Folder folder)
insert
public void insert(java.io.File file,
int index)
- Description copied from interface:
List
- Inserts an item into the list.
- Specified by:
insert
in interface List<java.io.File>
- Specified by:
insert
in interface Sequence<java.io.File>
- Overrides:
insert
in class ListAdapter<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 between
0 and getLength().- See Also:
ListListener.itemInserted(List, int)
update
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 interface List<java.io.File>
- Specified by:
update
in interface Sequence<java.io.File>
- Overrides:
update
in class ListAdapter<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
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.
- Specified by:
setComparator
in interface Collection<java.io.File>
- Specified by:
setComparator
in interface List<java.io.File>
- Overrides:
setComparator
in class ListAdapter<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)