pushWithLimit method
- E element,
- int limit
Adds element to this list and pops an element to keep the total length within limit.
Implementation
void pushWithLimit(E element, int limit) {
if (length >= limit) removeFirst();
addLast(element);
}
Adds element to this list and pops an element to keep the total length within limit.
void pushWithLimit(E element, int limit) {
if (length >= limit) removeFirst();
addLast(element);
}