All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.util.concurrent.LinkedBlockingDeque Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.

There is a newer version: 0.6.8
Show newest version
package java.util.concurrent;

import java.util.AbstractQueue;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;

public class LinkedBlockingDeque extends AbstractQueue implements BlockingDeque, java.io.Serializable {
	private LinkedList queue = new LinkedList<>();

	@Override
	public Iterator iterator() {
		return queue.iterator();
	}

	@Override
	public Iterator descendingIterator() {
		return queue.descendingIterator();
	}

	@Override
	public void push(E e) {
		queue.push(e);
	}

	@Override
	public E pop() {
		return queue.pop();
	}

	@Override
	public int size() {
		return queue.size();
	}

	@Override
	public void put(E e) throws InterruptedException {
		queue.add(e);
	}

	@Override
	public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
		return queue.offer(e);
	}

	@Override
	public E take() throws InterruptedException {
		return queue.remove();
	}

	@Override
	public E poll(long timeout, TimeUnit unit) throws InterruptedException {
		return queue.poll();
	}

	@Override
	public int remainingCapacity() {
		return Integer.MAX_VALUE;
	}

	@Override
	public int drainTo(Collection c) {
		return drainTo(c, Integer.MAX_VALUE);
	}

	@Override
	public int drainTo(Collection c, int maxElements) {
		int transferred = 0;
		while (queue.size() > 0 && transferred < maxElements) {
			c.add(queue.poll());
		}
		return transferred;
	}

	@Override
	public void addFirst(E e) {
		queue.addFirst(e);
	}

	@Override
	public void addLast(E e) {
		queue.addLast(e);
	}

	@Override
	public boolean offerFirst(E e) {
		return queue.offerFirst(e);
	}

	@Override
	public boolean offerLast(E e) {
		return queue.offerLast(e);
	}

	@Override
	public E removeFirst() {
		return queue.removeFirst();
	}

	@Override
	public E removeLast() {
		return queue.removeLast();
	}

	@Override
	public E pollFirst() {
		return queue.pollFirst();
	}

	@Override
	public E pollLast() {
		return queue.pollLast();
	}

	@Override
	public E getFirst() {
		return queue.getFirst();
	}

	@Override
	public E getLast() {
		return queue.getLast();
	}

	@Override
	public E peekFirst() {
		return queue.peekFirst();
	}

	@Override
	public E peekLast() {
		return queue.peekLast();
	}

	@Override
	public void putFirst(E e) throws InterruptedException {
		queue.addFirst(e);
	}

	@Override
	public void putLast(E e) throws InterruptedException {
		queue.addLast(e);
	}

	@Override
	public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
		return queue.offerFirst(e);
	}

	@Override
	public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
		return queue.offerLast(e);
	}

	@Override
	public E takeFirst() throws InterruptedException {
		return queue.pollFirst();
	}

	@Override
	public E takeLast() throws InterruptedException {
		return queue.pollLast();
	}

	@Override
	public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
		return queue.pollFirst();
	}

	@Override
	public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
		return queue.pollLast();
	}

	@Override
	public boolean removeFirstOccurrence(Object o) {
		return queue.removeFirstOccurrence(o);
	}

	@Override
	public boolean removeLastOccurrence(Object o) {
		return queue.removeLastOccurrence(o);
	}

	@Override
	public boolean offer(E e) {
		return queue.offer(e);
	}

	@Override
	public E poll() {
		return queue.poll();
	}

	@Override
	public E peek() {
		return queue.peek();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy