Package io.ebean.common
Class CopyOnFirstWriteList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- io.ebean.common.CopyOnFirstWriteList<E>
-
- All Implemented Interfaces:
Serializable
,Iterable<E>
,Collection<E>
,List<E>
public final class CopyOnFirstWriteList<E> extends AbstractList<E> implements List<E>, Serializable
List that copies itself on first write access. Needed to keep memory footprint low and the ability to modify lists from cache.- Author:
- Roland Praml, FOCONIS AG
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CopyOnFirstWriteList(List<E> list)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, E element)
boolean
add(E e)
boolean
addAll(int index, Collection<? extends E> c)
boolean
addAll(Collection<? extends E> c)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
equals(Object o)
E
get(int index)
int
hashCode()
int
indexOf(Object o)
boolean
isEmpty()
int
lastIndexOf(Object o)
E
remove(int index)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
removeIf(Predicate<? super E> filter)
void
replaceAll(UnaryOperator<E> operator)
boolean
retainAll(Collection<?> c)
E
set(int index, E element)
int
size()
void
sort(Comparator<? super E> c)
Object[]
toArray()
<T> T[]
toArray(T[] a)
-
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator, subList
-
Methods inherited from class java.util.AbstractCollection
toString
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
iterator, listIterator, listIterator, spliterator, subList
-
-
-
-
Constructor Detail
-
CopyOnFirstWriteList
public CopyOnFirstWriteList(List<E> list)
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceList<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceList<E>
- Overrides:
contains
in classAbstractCollection<E>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceList<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceList<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
add
public boolean add(E e)
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceList<E>
- Overrides:
add
in classAbstractList<E>
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceList<E>
- Overrides:
remove
in classAbstractCollection<E>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
- Overrides:
containsAll
in classAbstractCollection<E>
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceList<E>
- Overrides:
addAll
in classAbstractCollection<E>
-
addAll
public boolean addAll(int index, Collection<? extends E> c)
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceList<E>
- Overrides:
removeAll
in classAbstractCollection<E>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<E>
- Specified by:
retainAll
in interfaceList<E>
- Overrides:
retainAll
in classAbstractCollection<E>
-
replaceAll
public void replaceAll(UnaryOperator<E> operator)
- Specified by:
replaceAll
in interfaceList<E>
-
removeIf
public boolean removeIf(Predicate<? super E> filter)
- Specified by:
removeIf
in interfaceCollection<E>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceList<E>
- Overrides:
clear
in classAbstractList<E>
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<E>
- Specified by:
equals
in interfaceList<E>
- Overrides:
equals
in classAbstractList<E>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<E>
- Specified by:
hashCode
in interfaceList<E>
- Overrides:
hashCode
in classAbstractList<E>
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOf
in interfaceList<E>
- Overrides:
lastIndexOf
in classAbstractList<E>
-
-