Collectors.toList()

yesrin·2023년 12월 7일

TIL

목록 보기
13/15

오늘의 의문: 그냥 toList()와는 뭐가 다를까?

article.getCategories().stream()
                        .map(Category::getName)
                        .collect(Collectors.toList()))

List 형태로 내보낸다면 list의 수정이 가능하지만. ex) put? 이였나..

collect로 list를 내보내면 list를 변경 할 수 없다.

profile
안녕하세요! 틀린 정보는 댓글 달아 주세요.

0개의 댓글