At 11:29 17/3/01 -0800, Ram C wrote:
>---------------------------------------------------------------------
>Collections Javadoc.
>---------------------
>It is imperative that the user manually synchronize on the returned list
>when iterating over it:
>
> List list = Collections.synchronizedList(new ArrayList());
> ...
> synchronized(list) {
> Iterator i = list.iterator(); // Must be in synchronized block
> while (i.hasNext())
> foo(i.next());
> }
>
>Failure to follow this advice may result in non-deterministic behavior.
>
>------------------------------------------------------------------------
>
>I looks like if i use method 2, i would need synchronized blocks in all
>the places i'm using the priority queue.
>
>I prefer method 1(unless you see other benifits with going with method
>2), and will proceed and create a SyncronizedPriorityQueue.
kewl.
>Another dumb question...
>isFull() in BinaryHeap, though used only within BinaryHeap, is defined
>public, in that case should that be defined in the PriorityQueue interface?
I am not sure. Considering that the BinaryHeap expands on insert ...
>Also, the 'percolate' methods should be used only from within the BinaryHeap
>(after the insert and pop). Should they be really defined 'private' rather
>than 'protected'. I see a lot of other places where the methods should
>be really 'private' but defined 'protected'. Any reasoning for that?
I think at one stage they were. However everyone who use my work from a few
research groups would always bug me because it blocked reuse through
inheritance.
Cheers,
Pete
*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof." |
| - John Kenneth Galbraith |
*-----------------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]