Class AbstractCollectionWrapper<T>
- java.lang.Object
-
- psidev.psi.mi.jami.utils.collection.AbstractCollectionWrapper<T>
-
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
public abstract class AbstractCollectionWrapper<T> extends Object implements Collection<T>
Abstract list which is updating some properties when adding/removing elements.- Since:
11/02/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description AbstractCollectionWrapper(Collection<T> list)
Constructor for AbstractCollectionWrapper.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
add(T xref)
addboolean
addAll(Collection<? extends T> c)
void
clear()
clearboolean
contains(Object o)
boolean
containsAll(Collection<?> c)
Collection<T>
getWrappedList()
Getter for the fieldwrappedList
.boolean
isEmpty()
isEmptyIterator<T>
iterator()
iteratorprotected abstract boolean
needToPreProcessElementToAdd(T added)
Method to know if an element to add needs some processing or being wrappedprotected abstract boolean
needToPreProcessElementToRemove(Object o)
needToPreProcessElementToRemoveprotected abstract void
processElementToRemove(Object o)
processElementToRemoveprotected abstract T
processOrWrapElementToAdd(T added)
Method to process or wrap an element to be added to the listboolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
sizeObject[]
toArray()
toArray<T> T[]
toArray(T[] a)
toArray-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Constructor Detail
-
AbstractCollectionWrapper
public AbstractCollectionWrapper(Collection<T> list)
Constructor for AbstractCollectionWrapper.
- Parameters:
list
- aCollection
object.
-
-
Method Detail
-
size
public int size()
size
- Specified by:
size
in interfaceCollection<T>
- Returns:
- a int.
-
isEmpty
public boolean isEmpty()
isEmpty
- Specified by:
isEmpty
in interfaceCollection<T>
- Returns:
- a boolean.
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<T>
-
toArray
public Object[] toArray()
toArray
- Specified by:
toArray
in interfaceCollection<T>
- Returns:
- an array of
Object
objects.
-
toArray
public <T> T[] toArray(T[] a)
toArray
- Specified by:
toArray
in interfaceCollection<T>
- Type Parameters:
T
- a T object.- Parameters:
a
- an array of T objects.- Returns:
- an array of T objects.
-
add
public boolean add(T xref)
add
- Specified by:
add
in interfaceCollection<T>
- Parameters:
xref
- a T object.- Returns:
- a boolean.
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<T>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<T>
-
addAll
public boolean addAll(Collection<? extends T> c)
- Specified by:
addAll
in interfaceCollection<T>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<T>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<T>
-
clear
public void clear()
clear
- Specified by:
clear
in interfaceCollection<T>
-
getWrappedList
public Collection<T> getWrappedList()
Getter for the field
wrappedList
.- Returns:
- a
Collection
object.
-
needToPreProcessElementToAdd
protected abstract boolean needToPreProcessElementToAdd(T added)
Method to know if an element to add needs some processing or being wrapped- Parameters:
added
- : element that will be added to the collection- Returns:
- true if we need to process/ wrap the element that will be added
-
processOrWrapElementToAdd
protected abstract T processOrWrapElementToAdd(T added)
Method to process or wrap an element to be added to the list- Parameters:
added
- : element that will be added to the collection- Returns:
- the processed/wrapped element that will be added
-
processElementToRemove
protected abstract void processElementToRemove(Object o)
processElementToRemove
- Parameters:
o
- aObject
object.
-
-