I have the ViewValue class defined as follows:
class ViewValue {
private Long id;
private Integer value;
private String description;
private View view;
priv
You could ude a wrapper:
public class IdList impements List
{
private List underlying;
pubic IdList(List underying)
{
this.underlying = underying;
}
public Long get(int index)
{
return underlying.get(index).getId()
}
// other List methods
}
though thats even more tedious work, it could improve performance.
You could also implement your and my solution genericaly using reflection, but that woud be very bad for perforance.
Theres no short and easy generic solution in Java, Im afraid. In Groovy, you would simply use collect(), but I believe that involves reflection as well.