dev@jsr311.java.net

Re: JSR311: Breadcrumbs

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 29 Feb 2008 14:45:35 -0500

On Feb 29, 2008, at 2:27 PM, Stephan Koops wrote:

> Hello Marc,
>> The proposal would give you {"foo"=>FooResource, "foo/bar/
>> baz"=>BazResource}.
> with this change I agree. It's a good idea.
>
> I think it is better to start the keySet / entrySet iterator with
> the resource class created by the last sub resource locator, not
> with the root resource class. I think the case, that an app
> developer wants to get the resource class created this resource
> class or the second is more often than get the root resource class
> instance or the resource class created directly by the root resource
> instance.
>
I don't have a strong preference for order provided its predictable -
what do others think ?

> Perhaps it is possible to return the keys and the entries as List,
> to have an direct access via keys.get(index), but I have no very
> good idea to specify it.

Rather than one method returning a Map<URI,Object> we could have two
methods returning List<URI> and List<Object> ?

>
> One possibility is to define a Map sub interface which returns not
> Set, but a new OrderedSet (extending Set, and is unmodifiable) or
> something like this, which also implements get(index). But it's not
> a very good solution, because it require two new sub interfaces. I
> think this should be integrated in the java.util package; I think a
> lot of people could need this behaviour.
>
LinkedHashMap.keySet().toArray() ?

> The method should return an unmodifiable Map, IMO.
>
+1.

Thanks,
Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.