users@jax-rpc.java.net

Re: Call.getOutputParams

From: Peter C. Tribble <ptribble_at_hgmp.mrc.ac.uk>
Date: Tue, 26 Feb 2002 16:28:44 +0000

>>>> According to the JAX-RPC Specification, version 0.7, PD2, of Feb 1 2002,
>>>> section 8.2.4, the Call interface has a method
>>>>
>>>> java.util.Map getOutputParams()
...
>>>> The problem is that the contract for Map does not guarantee element
ordering,
>>>> so that it's not possible to get at the returned parameters in the order
>>>> they were sent.
>>>>
>>>> This simply doesn't work - the order of the returned elements is important.
>>>
>>>
>>> The method Map.values() is used to get a collection view of the
>>> values contained in this Map. The iterator from this collection
>>> view would provide the ordering (similar to a List) of output
>>> elements. The implementation of Map used in Call has to account
>>> for this ordering.

It can't; the Interface for Map explicitly specifies that no guarantees
are made regarding ordering. In some implementations of Map (like TreeMap)
you can specify an ordering based on a comparator for the keys, but that's
not the same things - to preserve a given order of entries the only option
is to use something that implements List. Besides, by specifying Map, you're
explicitly not specifying any particular implementation. To get the parameters
back in the right order, the specification has to require an interface is
guaranteed to preserve the order.

Using Map.values() returns the elements in essentially random order.
(Which gives my application a huge headeache.)

-Peter Tribble
HGMP Computing Services
http://www.hgmp.mrc.ac.uk/~ptribble/