Package jadex.collection
Class RwListWrapper<T>
java.lang.Object
jadex.collection.RwListWrapper<T>
- All Implemented Interfaces:
IRwDataStructure,Iterable<T>,Collection<T>,List<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 TypeMethodDescriptionvoidInserts an element at a position.booleanAppends an element to the list.booleanaddAll(int index, Collection<? extends T> c) Appends all elements of a collection, starting at the specified position.booleanaddAll(Collection<? extends T> c) Appends all elements of a collection.voidclear()Clears the list.booleanReturns if the list contains an object.booleancontainsAll(Collection<?> c) Returns if all elements of a collection are contained.get(int index) Gets an indexed element from the list.jadex.common.RwAutoLockGets the internal auto lock.intReturns the index of the first occurrence of an element.booleanisEmpty()Returns if the list is empty.iterator()Returns the iterator.intReturns 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.booleanRemoves an element from the list.booleanremoveAll(Collection<?> c) Removes all elements of a collection contained in the list.booleanretainAll(Collection<?> c) Retains all elements contained in the list also contained in a collection .Sets an indexed element in the list.intsize()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, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface jadex.collection.IRwDataStructure
getLock, getReadLock, getWriteLock, readLock, writeLockMethods inherited from interface java.util.List
equals, hashCode, replaceAll, 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:
getAutoLockin 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:
containsAllin interfaceCollection<T>- Specified by:
containsAllin 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:
lastIndexOfin 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:
listIteratorin interfaceList<T>- Returns:
- The list iterator.
-
listIterator
Returns the list iterator starting at a position. Warning: Use manual locking.- Specified by:
listIteratorin interfaceList<T>- Returns:
- The list iterator.
-
subList
Returns a view of the list. Warning: Use manual locking.
-