We have several areas where code like this can be seen
public Map extractData(ResultSet rs) throws SQLException, DataAccessException {
Map m = new HashMap();
while(rs.next()){
Jurisdiction j = new Jurisdiction();
m.put("code",rs.getLong(1) );
m.put("type",rs.getString(2));
m.put("id",rs.getLong(3) )
}
return m;
}
which works perfectly fine. The thing is I am hard-pressed to find a reason to re-write this in a “generic” way and if I do what “real” benefit does Map<String,Object> m give me (other than bounding to String keys)?
If there are R readers of the code, and it takes them N milliseconds to realize that m is
Map<String,Object>, then using generics would save approx. R x N milliseconds. Over time, this is significant. Also, you are improving the doc to the client (with something real, not just Javadoc).