> can anyone initiate a queue with the new index ??
This would normally be the sort of thing to consult the API docs about.
Nevertheless ...
> I am trying stuff like:
>
> //queue with max 20 int elements
> Queue<int> myQ = new Queue<int> (20);
Are you talking about java.util.Queue? That's an interface, so you
can't instantiate it directly. You must choose a particular
implementation to instantiate, and the answer to your question then
depends on which implementation is used. According to the API docs,
"known" implementations of Queue are AbstractQueue, ArrayBlockingQueue,
ConcurrentLinkedQueue, DelayQueue, LinkedBlockingQueue, LinkedList,
PriorityBlockingQueue, PriorityQueue, and SynchronousQueue. Some of
those are abstract classes, which you also cannot instantiate directly.
Furthermore, type parameters must be reference types, not primitive
types (such as int).
You might want something like this:
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
...
Queue<Integer> myQueue = new ArrayBlockingQueue(20);
You should, however, understand all the implications of choosing that
particular Queue implementation. The API docs should help you there.

Signature
John Bollinger
jobollin@indiana.edu
>can anyone initiate a queue with the new index ??
>I am trying stuff like:
>
>//queue with max 20 int elements
>Queue<int> myQ = new Queue<int> (20);
Queue is an interface, not a class. You can thus have a Queue
reference but you cannot directly instantiate a Queue.
look up Queue in the Sun docs to see the many concrete classes that
implement it. Let's presume you decided on an ArrayBlockingQueue<E>.
Then you could say
Queue<int> myQ = new ArrayBlockingQueue<int>(20);

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 19 Sep 2005 06:30 GMT
>Queue<int> myQ = new ArrayBlockingQueue<int>(20);
actually I have not tried that to see how far unboxing goes. You
would normally write that
Queue<Integer> myQ = new ArrayBlockingQueue<Integer>(20);

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
>can anyone initiate a queue with the new index ??
>I am trying stuff like:
>
>//queue with max 20 int elements
>Queue<int> myQ = new Queue<int> (20);
see http://mindprod.com/jgloss/queue.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.