Menu

#25 LazyMap.decorate incorrect signature

open
nobody
None
5
2008-10-15
2008-10-15
No

I believe LazyMap.decorate(Map<K, V> map, Factory<V> factory) should have following signature LazyMap.decorate(Map<K, V> map, Factory<? extends V> factory), so following snippet will work:

public class Sandbox {
public static void main(String[] args) {
Map<A, Collection<B>> map = LazyMap.decorate(new HashMap<A, Collection<B>>(), FactoryUtils.prototypeFactory(new ArrayList<B>()));
map.put(new A(), new ArrayList<B>());
}
}

class A { }

class B { }

Discussion


Log in to post a comment.