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>
,SequencedCollection<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 TypeMethodDescriptionvoid
Adds an element to the beginning of the list.void
Adds 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.boolean
Inserts the specified element.boolean
offerFirst
(T e) Adds the element at the end unless it would violate capacity restrictions.boolean
Adds 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.void
Pushes an element to the head of the list.remove()
Removes an element from the head of the list.Removes the element from the beginning.boolean
Removes the first occurrence of an element.Removes the last element in the list.boolean
Removes 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, toArray
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
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:
removeLast
in interfaceDeque<T>
- Specified by:
removeLast
in interfaceList<T>
- Specified by:
removeLast
in interfaceSequencedCollection<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:
offerFirst
in 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:
removeFirst
in interfaceDeque<T>
- Specified by:
removeFirst
in interfaceList<T>
- Specified by:
removeFirst
in interfaceSequencedCollection<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:
removeFirstOccurrence
in interfaceDeque<T>
- Parameters:
o
- Object being removed- Returns:
- True, if removed.
-
removeLastOccurrence
Removes the last occurrence of an element.- Specified by:
removeLastOccurrence
in 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:
descendingIterator
in interfaceDeque<T>
-
reversed
Unimplemented, here to resolve default method conflict in Java 21 while avoiding reimplementation of functionality in Java 17.
-