io.microsphere.concurrent.DelegatingBlockingQueue Maven / Gradle / Ivy
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.microsphere.concurrent;
import java.util.Collection;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
/**
* Delegating {@link BlockingQueue}
*
* @param – the type of elements held in this queue
* @author Mercy
* @since 1.0.0
*/
public class DelegatingBlockingQueue implements BlockingQueue {
private final BlockingQueue delegate;
public DelegatingBlockingQueue(BlockingQueue delegate) {
this.delegate = delegate;
}
@Override
public Iterator iterator() {
return delegate.iterator();
}
@Override
public Object[] toArray() {
return delegate.toArray();
}
@Override
public T[] toArray(T[] a) {
return delegate.toArray(a);
}
@Override
public boolean containsAll(Collection> c) {
return delegate.containsAll(c);
}
@Override
public boolean addAll(Collection extends E> c) {
return delegate.addAll(c);
}
@Override
public boolean removeAll(Collection> c) {
return delegate.removeAll(c);
}
@Override
public boolean removeIf(Predicate super E> filter) {
return delegate.removeIf(filter);
}
@Override
public boolean retainAll(Collection> c) {
return delegate.retainAll(c);
}
@Override
public void clear() {
delegate.clear();
}
@Override
public boolean equals(Object o) {
return delegate.equals(o);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public Spliterator spliterator() {
return delegate.spliterator();
}
@Override
public Stream stream() {
return delegate.stream();
}
@Override
public Stream parallelStream() {
return delegate.parallelStream();
}
@Override
public boolean add(E e) {
return delegate.add(e);
}
@Override
public boolean offer(E e) {
return delegate.offer(e);
}
@Override
public void put(E e) throws InterruptedException {
delegate.put(e);
}
@Override
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate.offer(e, timeout, unit);
}
@Override
public E take() throws InterruptedException {
return delegate.take();
}
@Override
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
return delegate.poll(timeout, unit);
}
@Override
public int remainingCapacity() {
return delegate.remainingCapacity();
}
@Override
public boolean remove(Object o) {
return delegate.remove(o);
}
@Override
public boolean contains(Object o) {
return delegate.contains(o);
}
@Override
public int drainTo(Collection super E> c) {
return delegate.drainTo(c);
}
@Override
public int drainTo(Collection super E> c, int maxElements) {
return delegate.drainTo(c, maxElements);
}
@Override
public E remove() {
return delegate.remove();
}
@Override
public E poll() {
return delegate.poll();
}
@Override
public E element() {
return delegate.element();
}
@Override
public E peek() {
return delegate.peek();
}
@Override
public int size() {
return delegate.size();
}
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
@Override
public void forEach(Consumer super E> action) {
delegate.forEach(action);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy