TypeOf(T) -- Fix you generic Map<K,V> issues
Monkey Forums/Monkey Code/TypeOf(T) -- Fix you generic Map<K,V> issues
| ||
Hi, The following codes fixes all your problems when you try to use maps/lists/sets + Generics. I hope it gets implemented into MX one day. |
| ||
What's the usage of this? Can't see where I would be using this? |
| ||
The default Map<K,V> cannot be used to stored values because CompareTo(..) is abstract. So you need a concrete implementation like IntMap, StringMap, etc. When you write a generic class / method / function and you like to use a map you don't now which of kind of map you need (because of T). Same for Set<T> and if you like to sort also for List<T> and Stack<T>. |
| ||
@Pharmhaus: Same for Set<T> and if you like to sort also for List<T> and Stack<T>. This is why I made DiddyStack, DiddyList, and DiddySet. They extend the base library classes and handle all the sorting/comparison stuff for you. They can also be interchangeable in some situations. https://code.google.com/p/diddy/source/browse/src/diddy/diddystack.monkey |