instance-initializers

How to use an instance initializer with a generic HashMap?

Can you use an instance initializer with a generic HashMap? I found this code online, but am having trouble converting it to a generic HashMap instead of a basic HashMap: someMethodThatTakesAHashMap(new HashMap(){{put("a","value-a"); put("c","value-c");}}); ...

Understanding this warning: The serializable class does not declare a static final serialVersionUID

I have some static initializer code: someMethodThatTakesAHashMap(new HashMap<K, V>() { { put("a","value-a"); put("c","value-c");} }); For some reason I am receiving a warning from Eclipse: The serializable class does not declare a static final serialVersionUID. Is this complaining about the anonymous class? What can I do about...