数组转为list集合 以及 java字符串的字符交换位置
数组转为list集合:
String[] array= {"张三","李四","王五"};
List<String> asList = Arrays.asList(array);
ArrayList arrayList = new ArrayList(asList);
arrayList.add("赵六");
System.out.println(arrayList.toString());
String str = "Reverse a String in Java";
StringBuilder sb = new StringBuilder(str).reverse();
System.out.println(sb.toString());
--------------------------------------------------------------
输出结果:
avaJ ni gnirtS a esreveR