users@jsr311.java.net

JAX-RS: generics: <String,Object> vs <String,?>

From: Manger, James H <James.H.Manger_at_team.telstra.com>
Date: Wed, 16 Jul 2008 16:56:17 +1000

One method in UriBuilder is
  build(Map<String,Object> values);

I think it should be
  build(Map<String,?> values);
so callers can pass, say, a Map<String,String> to the method – which is the most likely type they will be using.

build(…) only reads the Map so it should be fine with <String,?>.


I am not totally confident about this, because I am not totally confident about generics and I seem to be able to pass a Map<String,String> to the Jersey (0.9) implementation of build()!


James Manger