I have the ViewValue class defined as follows:
class ViewValue { private Long id; private Integer value; private String description; private View view; priv
We can do it in a single line of code using java 8
List ids = viewValues.stream().map(ViewValue::getId).collect(Collectors.toList());
For more info : Java 8 - Streams