jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Müller <thomas.muel...@day.com>
Subject Re: Generics generator class
Date Mon, 04 May 2009 15:13:58 GMT
Hi,

> In fact, while the "new HashMap<String, WorkspaceInfo>()"

It looks like there was a misunderstanding. You only need one method
hashMap(). This method will generate any kind of HashMap instance,
that means the exact same method is used to create:

HashMap<String, String> a = New.hashMap();
HashMap<NodeId, Node> b = New.hashMap();
HashMap<String, Value> c = New.hashMap();

I have counted the number of times this could be useful in Jackrabbit.
For the 2218 java files I counted (using grep -c -R --include=*.java
'new ArrayList' . | wc -l ):

new ArrayList: 586
new Hash: 477
new Linked: 65
new Weak: 24
new Tree: 21
new Stack: 19

By the way, I didn't invent using a generator function:

http://www.artima.com/forums/flat.jsp?forum=106&thread=79394
http://gafter.blogspot.com/2007/07/constructor-type-inference.html

Regards,
Thomas

Mime
View raw message