변환 | 코드 |
---|
List<Integer> → int[]
| list.stream().mapToInt(Integer::intValue).toArray();
|
int[] → List<Integer>
| Arrays.stream(arr).boxed().collect(Collectors.toList());
|
List<String> → String[]
| list.toArray(new String[0]);
|
String[] → List<String>
| Arrays.asList(arr);
|
List<Integer> → Integer[]
| list.toArray(new Integer[0]);
|
Integer[] → List<Integer>
| Arrays.asList(arr);
|
int[] → Integer[]
| Arrays.stream(arr).boxed().toArray(Integer[]::new);
|
Integer[] → int[]
| Arrays.stream(arr).mapToInt(Integer::intValue).toArray();
|
String → char[]
| str.toCharArray();
|
char[] → String
| new String(charArr);
|
String → int
| Integer.parseInt(str);
|
int → String
| Integer.toString(i); 또는 String.valueOf(i);
|