Re:The Universal Design Pattern
by michaelneale on Wednesday October 22, 2008 @06:12AM
(#339890)
Check out: http://gleichmann.wordpress.com/2008/01/13/building-your-own... for more tricks with varargs, generics and static imports to "pimp" things up a bit.
I'm not sure if anyone has been able to use generics and varargs to create a map generating static function, but it might be possible. Something like:
I think the trouble is with automatically extracting the key value types from the varargs array. I think I have seen the approach: where kv would just create a key value pair. That way you can make the generics inference come out right.All of this does make a pretty good argument for Python, Ruby, Javascript, etc.
UPDATE: just found this:
http://nicolas.lehuen.com/index.php/post/2006/10/07/113-java...
Pick your poison.