Skip to main content

How do I get the nth item in a queue in javaQueue?

I have a number of queues and priority queues in my application. I would like to easily access the nth items in these queues, but don't see an easy way to do that using the API. 

I guess I could create an iteratorIterator and iterate to the nth element or use toArray()[index]--buttoArray()[index], but it seems like there should be an easier way.

Am I missing something?

How do I get the nth item in a queue in java?

I have a number of queues and priority queues in my application. I would like to easily access the nth items in these queues, but don't see an easy way to do that using the API. I guess I could create an iterator and iterate to the nth or use toArray()[index]--but it seems like there should be an easier way.

Am I missing something?

How do I get the nth item in a Queue?

I have a number of queues and priority queues in my application. I would like to easily access the nth items in these queues, but don't see an easy way to do that using the API. 

I guess I could create an Iterator and iterate to the nth element or use toArray()[index], but it seems like there should be an easier way.

Am I missing something?

Source Link
bernie2436
  • 24.2k
  • 55
  • 160
  • 251

How do I get the nth item in a queue in java?

I have a number of queues and priority queues in my application. I would like to easily access the nth items in these queues, but don't see an easy way to do that using the API. I guess I could create an iterator and iterate to the nth or use toArray()[index]--but it seems like there should be an easier way.

Am I missing something?