A gentle reminder to myself: don’t make things more complicated than they need to be.
I’m in the process of creating a JSP tag to render a dynamic tree list, similar in intent to the JTree in Swing, but for JSPs. For one reason or another, I can’t seem to find one out there that already exists that does what I want.
In any case, having got a mocked-up HTML page with all the Javascript working, I need to turn it into a JSP. One part of what I’m going to need is data to construct the tree dynamically from. So, thinking of JTree, I start creating a TreeModel-like interface.
Then it hits me: all I want from the tree is a display value and a real value, and to be able to look up the display value from the real value. In other words, all I need is a Map. If the user (me) cares about order (yes), they can use a SortedMap or a LinkedHashMap.
This will save me a bucket of time later, especially because the data I will derive the tree list from is already a Map.
Simplicity really does help.