Today at work I wrote the following line of code:
private static DatedMap<String, DatedMap<String, DatedSet<DjteLog>>> projects = new DatedMap<String, DatedMap<String, DatedSet<DjteLog>>>();
I guess this means I need to do some refactoring or something?
In C# 3.0 that would be more like:
private static var projects = new DatedMap<String, DatedMap<String, DatedSet<DjteLog>>>();
No refactoring needed there, right =).
I don’t even know what that is.
There are so many things for one to be confused about there.
I bet you could do the same thing with 50% less characters in Ruby though.
I don’t even know what the original is.
I’m assuming ‘DatedMap
>>();’ is a sign of the end-times.
It’s generics stuff. So like, ‘DatedMap’ is basically a ‘TreeMap.’ Normally you put a bunch of Objects into a TreeMap, and you index them using a different Object. But then when you call DatedMap.get(aKey) you have to cast the result to the correct data type.
With generics in Java 1.5, when you create the DatedMap you tell the Java compiler that all the keys will be Strings and all the values will be DatedMap. Then the compiler does stricter type checking to make sure that you don’t put anything into the DatedMap that doesn’t belong there.
Can a brother get a Java typedef?
DatedMap is a class that extends TreeMap. DatedSet is a class that extends TreeSet. The only changes are that they keeps track of the date when the last Object was added or removed.