title: How to make BlockingQueue to accept multiple types?
body: <p>I have class <code>X</code>, class <code>Y</code> and class <code>Z</code>. If <code>X</code> or <code>Y</code> perform specific conditions, they should be put into <code>BlockingQueue</code>. Class <code>Z</code> just takes them from the queue.</p>
  
  <p>I know that creating something like this:</p>
  
  <pre><code>BlockingQueue&lt;X,Y&gt; BQueue=new ArrayBlockingQueue&lt;X,Y&gt;(length);
  </code></pre>
  
  <p>is illegal. How to make it properly?</p>