Example usage for java.util.concurrent ArrayBlockingQueue contains

List of usage examples for java.util.concurrent ArrayBlockingQueue contains

Introduction

In this page you can find the example usage for java.util.concurrent ArrayBlockingQueue contains.

Prototype

public boolean contains(Object o) 

Source Link

Document

Returns true if this queue contains the specified element.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int capacity = 100;
    ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(capacity);

    for (int i = 0; i < 100; i++) {
        queue.add(i);/*from  w  w  w  .  j  a v  a 2s  . c om*/
    }
    System.out.println(queue.contains(5));
    queue.clear();
    System.out.println(queue.contains(5));
}