|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fulmine.util.collection.ReferenceCountingList<COMPONENT>
COMPONENT
- the element type contained by the listpublic final class ReferenceCountingList<COMPONENT>
A List
implementation backed by an internal list. It only allows
unique entries but also provides counts per entry added/removed. If an entry
is added twice, it is only added once but will have a count of 2.
This is not thread safe.
Constructor Summary | |
---|---|
ReferenceCountingList()
|
|
ReferenceCountingList(int size)
|
|
ReferenceCountingList(List<COMPONENT> copy)
|
|
ReferenceCountingList(ReferenceCountingList<COMPONENT> copy)
|
Method Summary | ||
---|---|---|
boolean |
add(COMPONENT o)
Add the element to the list. |
|
void |
add(int index,
COMPONENT element)
|
|
boolean |
addAll(Collection<? extends COMPONENT> c)
|
|
boolean |
addAll(int index,
Collection<? extends COMPONENT> c)
|
|
void |
clear()
|
|
boolean |
contains(Object o)
|
|
boolean |
containsAll(Collection<?> c)
|
|
boolean |
equals(Object o)
|
|
COMPONENT |
get(int index)
|
|
int |
getCount(COMPONENT element)
Get the number of references this list maintains for the element. |
|
int |
hashCode()
|
|
int |
indexOf(Object o)
|
|
boolean |
isEmpty()
|
|
Iterator<COMPONENT> |
iterator()
|
|
int |
lastIndexOf(Object o)
|
|
ListIterator<COMPONENT> |
listIterator()
|
|
ListIterator<COMPONENT> |
listIterator(int index)
|
|
COMPONENT |
remove(int index)
|
|
boolean |
remove(Object o)
Remove the element from the list. |
|
boolean |
removeAll(Collection<?> c)
|
|
boolean |
retainAll(Collection<?> c)
|
|
COMPONENT |
set(int index,
COMPONENT element)
|
|
int |
size()
|
|
List<COMPONENT> |
subList(int fromIndex,
int toIndex)
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReferenceCountingList()
public ReferenceCountingList(int size)
public ReferenceCountingList(List<COMPONENT> copy)
public ReferenceCountingList(ReferenceCountingList<COMPONENT> copy)
Method Detail |
---|
public boolean add(COMPONENT o)
add
in interface Collection<COMPONENT>
add
in interface List<COMPONENT>
o
- the element to add
true
only if the element is actually addedList.add(Object)
public void add(int index, COMPONENT element)
add
in interface List<COMPONENT>
public boolean addAll(Collection<? extends COMPONENT> c)
addAll
in interface Collection<COMPONENT>
addAll
in interface List<COMPONENT>
public boolean addAll(int index, Collection<? extends COMPONENT> c)
addAll
in interface List<COMPONENT>
public void clear()
clear
in interface Collection<COMPONENT>
clear
in interface List<COMPONENT>
public boolean contains(Object o)
contains
in interface Collection<COMPONENT>
contains
in interface List<COMPONENT>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<COMPONENT>
containsAll
in interface List<COMPONENT>
public COMPONENT get(int index)
get
in interface List<COMPONENT>
public int indexOf(Object o)
indexOf
in interface List<COMPONENT>
public boolean isEmpty()
isEmpty
in interface Collection<COMPONENT>
isEmpty
in interface List<COMPONENT>
public Iterator<COMPONENT> iterator()
iterator
in interface Iterable<COMPONENT>
iterator
in interface Collection<COMPONENT>
iterator
in interface List<COMPONENT>
public int lastIndexOf(Object o)
lastIndexOf
in interface List<COMPONENT>
public ListIterator<COMPONENT> listIterator()
listIterator
in interface List<COMPONENT>
public ListIterator<COMPONENT> listIterator(int index)
listIterator
in interface List<COMPONENT>
public COMPONENT remove(int index)
remove
in interface List<COMPONENT>
public boolean remove(Object o)
remove
in interface Collection<COMPONENT>
remove
in interface List<COMPONENT>
o
- the element to remove
true
only if the element is actually removedList#remove(o)
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<COMPONENT>
removeAll
in interface List<COMPONENT>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<COMPONENT>
retainAll
in interface List<COMPONENT>
public COMPONENT set(int index, COMPONENT element)
set
in interface List<COMPONENT>
public int size()
size
in interface Collection<COMPONENT>
size
in interface List<COMPONENT>
public List<COMPONENT> subList(int fromIndex, int toIndex)
subList
in interface List<COMPONENT>
public Object[] toArray()
toArray
in interface Collection<COMPONENT>
toArray
in interface List<COMPONENT>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<COMPONENT>
toArray
in interface List<COMPONENT>
public int getCount(COMPONENT element)
IReferenceCountingList
List.add(Object)
increments the count, calls to
List.remove(Object)
decrements the count.
getCount
in interface IReferenceCountingList<COMPONENT>
element
- the element to query for the reference count
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in interface Collection<COMPONENT>
equals
in interface List<COMPONENT>
equals
in class Object
public int hashCode()
hashCode
in interface Collection<COMPONENT>
hashCode
in interface List<COMPONENT>
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |