Package net.cscott.jutil
Class CollectionWrapper<E>
java.lang.Object
net.cscott.jutil.CollectionWrapper<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>
- Direct Known Subclasses:
ListWrapper,SetWrapper
CollectionWrapper is a class that acts as a wrapper
around another Collection, using it as its backing store. This
class isn't meant for direct usage, but rather provides for an easy
way for developers to quickly add extra independent behavior to
their own specific Collections without having to reimplement all of
AbstractCollection's interface- Author:
- Felix S. Klock II <pnkfelix@mit.edu>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleaninthashCode()booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) toString()protected abstract Collection<E> wrapped()Implementations should return the wrappedCollectionhere.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
CollectionWrapper
protected CollectionWrapper()Creates aCollectionWrapper.
-
-
Method Details
-
wrapped
Implementations should return the wrappedCollectionhere.- Since:
- 1.3
-
add
- Specified by:
addin interfaceCollection<E>
-
addAll
- Specified by:
addAllin interfaceCollection<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<E>
-
iterator
-
remove
- Specified by:
removein interfaceCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>
-
size
public int size()- Specified by:
sizein interfaceCollection<E>
-
toArray
- Specified by:
toArrayin interfaceCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<E>
-
toString
-
equals
- Specified by:
equalsin interfaceCollection<E>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Overrides:
hashCodein classObject
-