This post originated from an RSS feed registered with Java Buzz
by Marc Logemann.
Original Post: Generics, IDEA and the fun to code
Feed Title: Marc's Java Blog
Feed URL: http://www.logemann.org/day/index_java.xml
Feed Description: Java related topics for all major areas. So you will see J2ME, J2SE and J2EE issues here.
Finally i migrated my first customer project to Java5, but migration is the wrong word, because there is no other migration than telling IDEA to use Java5 JDK. Because i am still doing J2SE Frontend stuff, i pretty much use Collections. In this case, i have a GUI screen with many fields, buttons and stuff. The dialog is a Filter dialog to filter records based on columns of a database like the one you know from Excel. Being lazy, i decided to put the components into different Lists.
Ok, now its time to put some components in there, of course, we IDEA users are kind of shortcut freaks, sometimes i use so many shortcuts that it can hardly be called coding ;-) Here its just a trivial auto-complete function, but look at the proposed type for the addition to the List. Yikes. As expected my parametrized Type JComboBox.
Getting things out of Collections, JBuilder users most likely enter the Type and reference name manually and then call the method from the List (sorry couldnt resist). In IDEA land we just enter the method call and type "CTRL+ALT+V" and IDEA does the rest, also this time, it perfectly knows what type is in the collection.
Finally i also used the new Foreach loop, which rocks in any way.
All in all, i only touched the surface of Generics by just using the generified collection classes. IDEA does its job as advertised and overall, its not a big deal, so why write about that? Because its real fun. The combination of a cool programming technique, combined with still the best IDE on this world.