java 8 Stream을 활용하여 객체 리스트를 String이나 Integer 형태의 List로 변환
List<Person> persons = ... List<String> ids = persons .stream() .map(e -> e.id) .collect(Collectors.toCollection(ArrayList::new));
ref. 김용환 블로그(2004-2020)