List<Object> to List<String>

𝙃𝙖𝙞𝙡𝙚𝙮·2022년 5월 20일
0

우당탕탕 자바8

목록 보기
1/4

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)

profile
ෆ 𝓋𝒾𝓈 𝓉𝒶 𝓋𝒾𝑒 ෆ

0개의 댓글