728x90
반응형
이 문서는 추후 다시 볼 목적으로 정리한 글입니다.
map 을 string array 로 변환
- map 의 value 기반으로 string array 로 변환
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, String> map = new HashMap<>(); | |
map.put("aaa.123", "test"); | |
map.put("bbb.456", "test11"); | |
map.put("ccc.789", "test22"); | |
String [] arr = map.entrySet().stream() | |
.map(s -> s.getValue()) | |
.toArray(String[]::new) | |
; | |
for (String s : arr) { | |
System.out.println(s); | |
} |
'Java > stream' 카테고리의 다른 글
java stream 예제 - set --> map, list --> map (0) | 2020.07.09 |
---|---|
java stream 예제 - map 에서 최소,최대 값 구하기. (0) | 2020.07.09 |
java stream 예제 - List 안에 List 의 값에서 특정 조건을 만족하는 값을 찾는 것 (0) | 2020.07.09 |
java stream 예제 - array 에서 min, max 구하기. (0) | 2020.07.09 |
java stream 예제 - sum (0) | 2020.07.09 |
댓글