集合中的字母全部转换成大写
public class Demo1 {
public static void main(String[] args) {
// 把features集合中的字母全部转换成大写
List<String> features = Arrays.asList("Lambdas", "Default Method", "Stream API", "Stream API", "Date and Time API");
ArrayList<String> list = new ArrayList<String>();
for (String strs : features) {
String s="";
char[] cs2 = strs.toCharArray();
for (int i = 0; i < cs2.length; i++) {
cs2[i] = Character.toUpperCase(cs2[i]);
s+=String.valueOf(cs2[i]);
}
list.add(s);
}
for (String str:list
) {
System.out.println(str);
}
}
}