Today I saw a class similar to this at my work place:
public class A {
private Map<String, A> myMap = Maps.newHashMap();
}
The code compiles, works and does what it suppose to do. But it can be refactored to different design. But I don't understand why this design was chosen.
You can do silly things like this:
this.myMap.get("x").myMap.get("x").myMap.get("x");
My question:
Is there a really a good situation where we need to apply such design? Why?
Aucun commentaire:
Enregistrer un commentaire