Live to learn

This is an old article from 2012. I was a kid. I learned a lot since then, so please do think twice when taking advice from me as a kid.

Just spent a whole hour on a stupid problem:

//... (Storeable is an interface)

HashMap<String, Class<? extends Storeable>> types = new HashMap<String, Class<? extends Storeable>>();

//... (object is an instance of a class that implements Storeable)

types.add(object.getTag(), object.getClass());

//...

Thought it was a problem with the Generics, but the Generics are fine. Here is the solution:

types.put(object.getTag(), object.getClass());

facepalm

This post was imported from tumblr