Class ConsumableBlockingQueue<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.ArrayBlockingQueue<T>
-
- uk.gov.gchq.gaffer.commonutil.iterable.ConsumableBlockingQueue<T>
-
- Type Parameters:
T
- the type of object in the queue
- All Implemented Interfaces:
Serializable
,Iterable<T>
,Collection<T>
,BlockingQueue<T>
,Queue<T>
public class ConsumableBlockingQueue<T> extends ArrayBlockingQueue<T>
Extension toArrayBlockingQueue
to allow consumers to iterate over the queue, consuming the data, without being blocked.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConsumableBlockingQueue(int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Warning - this will convert the entire queue to an array to check if the items are equal so use it with with caution.int
hashCode()
Warning - this will convert the entire queue to an array to get a hashcode, so use it with caution.Iterator<T>
iterator()
String
toString()
Warning - this will convert the entire queue to an array to get a string, so use with caution.-
Methods inherited from class java.util.concurrent.ArrayBlockingQueue
add, clear, contains, drainTo, drainTo, forEach, offer, offer, peek, poll, poll, put, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, take, toArray, toArray
-
Methods inherited from class java.util.AbstractQueue
addAll, element, remove
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty
-
Methods inherited from interface java.util.Collection
addAll, containsAll, isEmpty, parallelStream, stream, toArray
-
-
-
-
Method Detail
-
iterator
@Nonnull public Iterator<T> iterator()
- Specified by:
iterator
in interfaceCollection<T>
- Specified by:
iterator
in interfaceIterable<T>
- Overrides:
iterator
in classArrayBlockingQueue<T>
-
equals
public boolean equals(Object obj)
Warning - this will convert the entire queue to an array to check if the items are equal so use it with with caution.- Specified by:
equals
in interfaceCollection<T>
- Overrides:
equals
in classObject
- Parameters:
obj
- the object to compare- Returns:
- true if equal, otherwise false.
-
hashCode
public int hashCode()
Warning - this will convert the entire queue to an array to get a hashcode, so use it with caution.- Specified by:
hashCode
in interfaceCollection<T>
- Overrides:
hashCode
in classObject
-
toString
public String toString()
Warning - this will convert the entire queue to an array to get a string, so use with caution.- Overrides:
toString
in classArrayBlockingQueue<T>
-
-