Java 7 :
Example1:
return jdbcTemplate.query(sqlQueryToFetchList, new RowMapper() {
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
return rs.getString(1);
}
});
Example2:
Collections.sort(list, new Comparator>() {
public int compare(Entry o1, Entry o2) {
return (o2.getValue()).compareTo(o1.getValue());
}
});
Java 8:
Example1: return jdbcTemplate.query( sqlQuery , (ResultSet rs, int rownum) -> rs.getString(1)); Example2: Collections.sort(list, (o1, o2) -> o2.getValue().compareTo(o1.getValue()));
