E
- 元素类型public class CheckedLinkedBlockingQueue<E> extends LinkedBlockingQueue<E>
LinkedBlockingQueue
,给定一个检查函数,在加入元素前检查此函数Constructor and Description |
---|
CheckedLinkedBlockingQueue(Collection<? extends E> c,
Predicate<E> checker)
构造
|
CheckedLinkedBlockingQueue(Predicate<E> checker)
构造
|
Modifier and Type | Method and Description |
---|---|
boolean |
offer(E e) |
boolean |
offer(E e,
long timeout,
TimeUnit unit) |
void |
put(E e) |
clear, contains, drainTo, drainTo, iterator, peek, poll, poll, remainingCapacity, remove, size, spliterator, take, toArray, toArray, toString
add, addAll, element, remove
containsAll, isEmpty, removeAll, retainAll
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, stream
public CheckedLinkedBlockingQueue(Predicate<E> checker)
checker
- 检查函数public CheckedLinkedBlockingQueue(Collection<? extends E> c, Predicate<E> checker)
c
- 初始集合checker
- 检查函数public void put(E e) throws InterruptedException
put
in interface BlockingQueue<E>
put
in class LinkedBlockingQueue<E>
InterruptedException
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer
in interface BlockingQueue<E>
offer
in class LinkedBlockingQueue<E>
InterruptedException
public boolean offer(E e)
offer
in interface BlockingQueue<E>
offer
in interface Queue<E>
offer
in class LinkedBlockingQueue<E>
Copyright © 2025. All rights reserved.