Recently, I often have to read Java code as follows:
LinkedHashMap<String, Integer> totals = new LinkedHashMap<String, Integer>(listOfRows.get(0))
for (LinkedHashMap<String, Integer> row : (ArrayList<LinkedHashMap<String,Integer>>) table.getValue()) {
for(Entry<String, Integer> elem : row.entrySet()) {
String colName=elem.getKey();
int Value=elem.getValue();
int oldValue=totals.get(colName);
int sum = Value + oldValue;
totals.put(colName, sum);
}
}
Due to the long and nested type definition, a simple algorithm becomes completely obscure. Therefore, I would like to remove or collapse type definitions using my IDE to see Java code without types such as:
totals = new (listOfRows.get(0))
for (row : table.getValue()) {
for(elem : row.entrySet()) {
colName=elem.getKey();
Value=elem.getValue();
oldValue=totals.get(colName);
sum = Value + oldValue;
totals.put(colName, sum);
}
}
The best way, of course, would be to collapse the type definitions, but when moving the mouse over a variable, display the type as a tooltip. Is there a Java IDE or plugin for the IDE that can do this?
source
share