Package jadex.collection
Class RwListWrapper<T>
java.lang.Object
jadex.collection.RwListWrapper<T>
- All Implemented Interfaces:
IRwDataStructure
,Iterable<T>
,Collection<T>
,List<T>
,SequencedCollection<T>
- Direct Known Subclasses:
RwLinkedListWrapper
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRwListWrapper
(List<T> list) Creates the list wrapper.RwListWrapper
(List<T> list, ReadWriteLock lock) Creates the list wrapper with a specific internal lock. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts an element at a position.boolean
Appends an element to the list.boolean
addAll
(int index, Collection<? extends T> c) Appends all elements of a collection, starting at the specified position.boolean
addAll
(Collection<? extends T> c) Appends all elements of a collection.void
clear()
Clears the list.boolean
Returns if the list contains an object.boolean
containsAll
(Collection<?> c) Returns if all elements of a collection are contained.get
(int index) Gets an indexed element from the list.jadex.common.RwAutoLock
Gets the internal auto lock.int
Returns the index of the first occurrence of an element.boolean
isEmpty()
Returns if the list is empty.iterator()
Returns the iterator.int
Returns the index of the last occurrence of an element.Returns the list iterator.listIterator
(int index) Returns the list iterator starting at a position.remove
(int index) Removes an indexed element from the list.boolean
Removes an element from the list.boolean
removeAll
(Collection<?> c) Removes all elements of a collection contained in the list.boolean
retainAll
(Collection<?> c) Retains all elements contained in the list also contained in a collection .Sets an indexed element in the list.int
size()
Returns the list size.subList
(int fromindex, int toindex) Returns a view of the list.Object[]
toArray()
Returns the list elements as an array.<T> T[]
toArray
(T[] a) Returns the list elements as an array.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
parallelStream, removeIf, stream, toArray
Methods inherited from interface jadex.collection.IRwDataStructure
getLock, getReadLock, getWriteLock, readLock, writeLock
Methods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Field Details
-
list
The wrapped list.
-
-
Constructor Details
-
RwListWrapper
Creates the list wrapper.- Parameters:
list
- The wrapped List.
-
RwListWrapper
Creates the list wrapper with a specific internal lock.- Parameters:
list
- The wrapped List.
-
-
Method Details
-
getAutoLock
public jadex.common.RwAutoLock getAutoLock()Gets the internal auto lock.- Specified by:
getAutoLock
in interfaceIRwDataStructure
- Returns:
- The lock.
-
size
public int size()Returns the list size. -
isEmpty
public boolean isEmpty()Returns if the list is empty. -
contains
Returns if the list contains an object. -
iterator
Returns the iterator. Warning: Use manual locking. -
toArray
Returns the list elements as an array. -
toArray
public <T> T[] toArray(T[] a) Returns the list elements as an array. -
add
Appends an element to the list. -
remove
Removes an element from the list. -
containsAll
Returns if all elements of a collection are contained.- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceList<T>
- Parameters:
c
- The collection.- Returns:
- True, if all elements are contained in the list.
-
addAll
Appends all elements of a collection. -
addAll
Appends all elements of a collection, starting at the specified position. -
removeAll
Removes all elements of a collection contained in the list. -
retainAll
Retains all elements contained in the list also contained in a collection . -
clear
public void clear()Clears the list. -
get
Gets an indexed element from the list. -
set
Sets an indexed element in the list. -
add
Inserts an element at a position. -
remove
Removes an indexed element from the list. -
indexOf
Returns the index of the first occurrence of an element. -
lastIndexOf
Returns the index of the last occurrence of an element.- Specified by:
lastIndexOf
in interfaceList<T>
- Parameters:
o
- Object to be found.- Returns:
- Found position or -1 if not found.
-
listIterator
Returns the list iterator. Warning: Use manual locking.- Specified by:
listIterator
in interfaceList<T>
- Returns:
- The list iterator.
-
listIterator
Returns the list iterator starting at a position. Warning: Use manual locking.- Specified by:
listIterator
in interfaceList<T>
- Returns:
- The list iterator.
-
subList
Returns a view of the list. Warning: Use manual locking.
-