Package jadex.collection
Class RwLinkedListWrapper<T>
java.lang.Object
jadex.collection.RwListWrapper<T>
jadex.collection.RwLinkedListWrapper<T>
- All Implemented Interfaces:
IRwDataStructure,Iterable<T>,Collection<T>,Deque<T>,List<T>,Queue<T>
-
Field Summary
Fields inherited from class jadex.collection.RwListWrapper
list -
Constructor Summary
ConstructorsConstructorDescriptionRwLinkedListWrapper(LinkedList<T> list) Creates the list wrapper.RwLinkedListWrapper(LinkedList<T> list, ReadWriteLock lock) Creates the list wrapper with a specific internal lock. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an element to the beginning of the list.voidAdds an element to the end of the list.element()Gets an element from the head of the list.getFirst()Gets first list element.getLast()Gets last list element.booleanInserts the specified element.booleanofferFirst(T e) Adds the element at the end unless it would violate capacity restrictions.booleanAdds the element at the end unless it would violate capacity restrictions.peek()Gets an element from the head of the list.Gets first list element.peekLast()Gets last list element.poll()Removes an element from the head of the list.Removes the element from the beginning, returns null if this list is empty.pollLast()Removes the element from the end, returns null if this list is empty.pop()Pops an element from the head of the list.voidPushes an element to the head of the list.remove()Removes an element from the head of the list.Removes the element from the beginning.booleanRemoves the first occurrence of an element.Removes the last element in the list.booleanRemoves the last occurrence of an element.reversed()Unimplemented, here to resolve default method conflict in Java 21 while avoiding reimplementation of functionality in Java 17.Methods inherited from class jadex.collection.RwListWrapper
add, add, addAll, addAll, clear, contains, containsAll, get, getAutoLock, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArrayMethods 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
-
Constructor Details
-
RwLinkedListWrapper
Creates the list wrapper.- Parameters:
list- The wrapped List.
-
RwLinkedListWrapper
Creates the list wrapper with a specific internal lock.- Parameters:
list- The wrapped List.
-
-
Method Details
-
removeLast
Removes the last element in the list.- Specified by:
removeLastin interfaceDeque<T>- Returns:
- Element remove from list.
-
addFirst
Adds an element to the beginning of the list. -
addLast
Adds an element to the end of the list. -
offerFirst
Adds the element at the end unless it would violate capacity restrictions.- Specified by:
offerFirstin interfaceDeque<T>- Parameters:
e- The element.- Returns:
- True, if the element was added.
-
offerLast
Adds the element at the end unless it would violate capacity restrictions. -
removeFirst
Removes the element from the beginning.- Specified by:
removeFirstin interfaceDeque<T>- Returns:
- The element that was removed.
-
pollFirst
Removes the element from the beginning, returns null if this list is empty. -
pollLast
Removes the element from the end, returns null if this list is empty. -
getFirst
Gets first list element. -
getLast
Gets last list element. -
peekFirst
Gets first list element. -
peekLast
Gets last list element. -
removeFirstOccurrence
Removes the first occurrence of an element.- Specified by:
removeFirstOccurrencein interfaceDeque<T>- Parameters:
o- Object being removed- Returns:
- True, if removed.
-
removeLastOccurrence
Removes the last occurrence of an element.- Specified by:
removeLastOccurrencein interfaceDeque<T>- Parameters:
o- Object being removed- Returns:
- True, if removed.
-
offer
Inserts the specified element. -
remove
Removes an element from the head of the list. -
poll
Removes an element from the head of the list. -
element
Gets an element from the head of the list. -
peek
Gets an element from the head of the list. -
push
Pushes an element to the head of the list. -
pop
Pops an element from the head of the list. -
descendingIterator
- Specified by:
descendingIteratorin interfaceDeque<T>
-
reversed
Unimplemented, here to resolve default method conflict in Java 21 while avoiding reimplementation of functionality in Java 17.
-