http://venus.cs.depaul.edu/Java/chap08.html
2. "It is possible for a Queue implementation to restrict the number of elements that it holds; such queues are known as bounded. Some Queue implementations in java.util.concurrent are bounded, but the implementations in java.util are not.
http://java.sun.com/docs/books/tutorial/collections/interfaces/queue.html
3. Well , java.util.PriorityQueue has a constructor PriorityQueue (int initialCapacity) so is it bounded (1) or not (2) ? I am assuming that "restricting size" has something to do with capacity  is that true ?
4. How can I estimate capacity if I know the number of objects a Collection contains ?
5. What happens when a Collection exceeds its capacity  exception , silently give me some more ?
Thank you
Graeme Byers wrote:3. Well , java.util.PriorityQueue has a constructor PriorityQueue (int initialCapacity) so is it bounded (1) or not (2) ? I am assuming that "restricting size" has something to do with capacity  is that true ?
From its API:
An unbounded priority queue based on a priority heap.
So (2).
4. How can I estimate capacity if I know the number of objects a Collection contains ?
If the class does not have a method for it, you can't.
5. What happens when a Collection exceeds its capacity  exception , silently give me some more ?
If with capacity you mean the capacity like PriorityQueue and ArrayList have, then it will increase the capacity when necessary.
If you mean the capacity of a bounded collection, it depends on the class. Some may block until there is enough space (by removing other elements from another thread), some may throw an exception. Always check the class API.
SCJP 1.4  SCJP 6  SCWCD 5  OCEEJBD 6  OCEJPAD 6
How To Ask Questions How To Answer Questions
3. Well , java.util.PriorityQueue has a constructor PriorityQueue (int initialCapacity) so is it bounded (1) or not (2) ? I am assuming that "restricting size" has something to do with capacity  is that true ?
No. PriorityQueue is not bounded. Being able to specify the initial capacity is not the same as being able to specify the maximum capacity. A PriortityQueue can grow in an unbounded manner.
4. How can I estimate capacity if I know the number of objects a Collection contains ?
5. What happens when a Collection exceeds its capacity  exception , silently give me some more ?
I beleive most (if not all) of the bounded queues, are blocking queues, so the adding to a queue will wait until there is room.
Henry
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
ScroogeXHTML 7.2  RTF to HTML5 / XHTML converter
https://coderanch.com/t/692027/ScroogeXHTMLRTFHTMLXHTMLconverter
