1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| String[] arrays = {"a", "b", "c"}; List<String> list = Arrays.asList(arrays);
List<String> list = new ArrayList<>(Arrays.asList(arrays));
Object[] array = list.toArray();
String[] array = list.toArray(new String[0]); Integer[] integers = integerList.toArray(new Integer[0]);
List<Integer> list = Arrays.asList(1, 2, 3); int[] array = list.stream().mapToInt(Integer::intValue).toArray();
List<List<Integer>> res = new ArrayList<>(); int[][] arrays = res.stream() .map(list->list.stream().mapToInt(Integer::intValue).toArray()) .toArray(int[][]::new);
int[] a = new int[]{1, 2, 3}; List<Integer> integers = Arrays.stream(a).boxed().collect(Collectors.toList());
int[][] intArray = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; List<List<Integer>> list = Arrays.stream(intArray) .map(row -> Arrays.stream(row).boxed().collect(Collectors.toList())) .collect(Collectors.toList());
String s = "123"; int num = Integer.parseInt(s); Integer num = Integer.valueOf(s);
int num = 123; String s = String.valueOf(num); String s = Integer.toString(num);
String s = "hello"; char[] ch = s.toCharArray();
String[] array = {"hello", "world"}; String result = String.join("", array);
int[] array = {1, 2, 3}; String result = Arrays.toString(array);
String s = "a, b, c"; List<String> list = Arrays.asList(s.spilt(",")); String[] str = s.split(",");
String s = "Hello"; String upper = s.toUpperCase(); String lower = s.toLowerCase();
|