Hello guys,
I have one question. What does it mean when you put <..> in the class declaration line? Here is one example, KeyType is in there:
when calling registerEvent method, the input to a KeyType place goes a String. How come? Can anyone explain?
public class InternalEventManager<KeyType> { HashMap<KeyType, ArrayList<WeakReference<InternalEventListener>>> eventMap = new HashMap<KeyType, ArrayList<WeakReference<InternalEventListener>>>(); public void registerEvent(KeyType type, InternalEventListener event) { if (!eventMap.containsKey(type)) { eventMap.put(type, new ArrayList<WeakReference<InternalEventListener>>()); } ArrayList<WeakReference<InternalEventListener>> list = eventMap.get(type); WeakReference<InternalEventListener> reference = new WeakReference<InternalEventListener>(event); if (!contains(type, event)) { list.add(reference); } }