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 booleanadd(T xref)addbooleanaddAll(Collection<? extends T> c)voidclear()clearbooleancontains(Object o)booleancontainsAll(Collection<?> c)Collection<T>getWrappedList()Getter for the fieldwrappedList.booleanisEmpty()isEmptyIterator<T>iterator()iteratorprotected abstract booleanneedToPreProcessElementToAdd(T added)Method to know if an element to add needs some processing or being wrappedprotected abstract booleanneedToPreProcessElementToRemove(Object o)needToPreProcessElementToRemoveprotected abstract voidprocessElementToRemove(Object o)processElementToRemoveprotected abstract TprocessOrWrapElementToAdd(T added)Method to process or wrap an element to be added to the listbooleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)intsize()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- aCollectionobject.
-
-
Method Detail
-
size
public int size()
size
- Specified by:
sizein interfaceCollection<T>- Returns:
- a int.
-
isEmpty
public boolean isEmpty()
isEmpty
- Specified by:
isEmptyin interfaceCollection<T>- Returns:
- a boolean.
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<T>
-
toArray
public Object[] toArray()
toArray
- Specified by:
toArrayin interfaceCollection<T>- Returns:
- an array of
Objectobjects.
-
toArray
public <T> T[] toArray(T[] a)
toArray
- Specified by:
toArrayin 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:
addin interfaceCollection<T>- Parameters:
xref- a T object.- Returns:
- a boolean.
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<T>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<T>
-
addAll
public boolean addAll(Collection<? extends T> c)
- Specified by:
addAllin interfaceCollection<T>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<T>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<T>
-
clear
public void clear()
clear
- Specified by:
clearin interfaceCollection<T>
-
getWrappedList
public Collection<T> getWrappedList()
Getter for the field
wrappedList.- Returns:
- a
Collectionobject.
-
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- aObjectobject.
-
-