Noel J. Bergman wrote:
If the question is whether the interface should change, there ought to be
reasons.  So far, I have not seen any was my point.
Ok, I just meant that you can't reference the implementation if we're talking interfaces.

I understand, and I am all for meaningful contracts.  My point is that a
Java Collection is not unordered.  It can be either ordered or unordered,
based upon the implementation class.
Yes, this is my point... we should not leave it up to the implementation as to whether it is ordered or not.

Agreed, a Collection is ordered or unordered. And a List is, "An ordered collection (also known as a sequence)" as you quoted from the javadocs. Since the MX record query produce an ordered set of IP addresses, I'm saying the interface should return an ordered collection.

The ListIterator also adds backwards traversal, list mutators, and index
operations.
Backwards trasversal is a consequence of having order. Mutators also are a consequence of order. Index operations are a consequence of having order while allowing duplicates.

None of these List behaviors are necessary parts of the client contract we
need to expose as far as I can see.  All that we require is that the
elements be ordered according to our application (RFC) defined scheme.  But
by changing the interface to a List, we preclude the ability to use any
other type of ordered collection.
The only other ordered collections I know of aside from List is the SortedSet. If we can determine whether we need to allow duplicates, we can choose one or the other. I'm not looking to enable methods that shouldn't be allowed on this result, but for the same reason that we return a Collection instead of an Object, if we have certain characteristics that we know should be present in the result, we should pick the appropriate interface.

I hope I am clearer now.
Yes, and I hope I am as well.

--
Serge Knystautas
Loki Technologies
http://www.lokitech.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to