ca.odell.glazedlists
Class UniqueList<E>
- EventListener, EventList<E>, List, ListEventListener<E>
public final class UniqueList<E>
An
EventList
that shows the unique elements from its source
EventList
. For example, the source list {A, A, B, C, C, C, D} would
be simplified to {A, B, C, D} by this UniqueList.
Warning: This class breaks
the contract required by
List
. See
EventList
for an example.
EventList Overview |
Writable: | yes |
Concurrency: | thread ready, not thread safe |
Performance: | |
Memory: | N/A |
Unit Tests: | N/A |
Issues: |
27
34
35
45
46
55
58
114
|
UniqueList(EventList source) - Creates a
UniqueList that determines uniqueness via the
Comparable interface.
|
UniqueList(EventList source, Comparator comparator) - Creates a
UniqueList that determines uniqueness using the
specified Comparator .
|
void | dispose() -
|
List | getAll(E value) - Returns a List of all original elements represented by the given
value within this UniqueList .
|
List | getAll(int index) - Returns a List of all original elements represented by the value at the
given
index within this UniqueList .
|
int | getCount(E value) - Returns the number of duplicates of the specified value.
|
int | getCount(int index) - Returns the number of duplicates of the value found at the specified index.
|
protected int | getSourceIndex(int index) -
|
int | indexOf(Object element) - Returns the index in this list of the first occurrence of the specified
element , or -1 if this list does not contain this
element .
|
protected boolean | isWritable() -
|
void | listChanged(ListEvent listChanges) -
|
E | remove(int index) -
|
E | set(int index, E value) -
|
int | size() -
|
add , addAll , clear , dispose , get , getSourceIndex , isWritable , listChanged , remove , removeAll , retainAll , set , size |
T[] toArray , add , add , addAll , addAll , addListEventListener , clear , contains , containsAll , equals , get , getPublisher , getReadWriteLock , hashCode , indexOf , isEmpty , iterator , lastIndexOf , listIterator , listIterator , remove , remove , removeAll , removeListEventListener , retainAll , set , size , subList , toArray , toString |
UniqueList
public UniqueList(EventList source)
Creates a
UniqueList
that determines uniqueness via the
Comparable
interface. All elements of the source
EventList
must implement
Comparable
.
source
- the EventList
containing duplicates to remove
UniqueList
public UniqueList(EventList source,
Comparator comparator)
Creates a
UniqueList
that determines uniqueness using the
specified
Comparator
.
source
- the EventList
containing duplicates to removecomparator
- the Comparator
used to determine equality
getAll
public List getAll(E value)
Returns a List of all original elements represented by the given
value
within this
UniqueList
.
getAll
public List getAll(int index)
Returns a List of all original elements represented by the value at the
given
index
within this
UniqueList
.
getCount
public int getCount(E value)
Returns the number of duplicates of the specified value.
getCount
public int getCount(int index)
Returns the number of duplicates of the value found at the specified index.
indexOf
public int indexOf(Object element)
Returns the index in this list of the first occurrence of the specified
element
, or -1 if this list does not contain this
element
. More formally, returns the lowest index
i
such that
uniqueListComparator.compare(get(i), element) == 0,
or -1 if there is no such index.
Note: This is a departure from the contract for
List.indexOf
since it does not guarantee that
element.equals(get(i)) where i
is a positive index returned from this method.
- indexOf in interface AbstractEventList<E>
element
- the element to search for.
- the index in this list of the first occurrence of the specified
element, or -1 if this list does not contain this element
Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by buildd at 2008-01-04 14:38