在最后一个字符串中,计算仅由唯一字符组成的字符串,仅使用 Java StreamAPL 忽略空字符串我想我需要遍历 List 元素的符号并找到匹配项,但我不知道如何使用 Stream
`public static int scannerInt(){
String inputInt = scannerString();
int result;
if (inputInt.matches("\\d+")){ //'''''''''''''''''''''''''
result = Integer.parseInt(inputInt); //Here we check whether the number is
} // entered
else { // '''''''''''''''''''''''''
System.out.println("You entered incorrect character.\nYou only need to enter
numbers!Try again : ");
result = scannerInt();
}
return result;
}
//Here we just add elements to the List let it be "mom , eagle , brown , book , group".The
//result should be 3//(eagle,brown,group)
enter code here`public static void countUniqueCharactersStream() {
List<String> stringList = new ArrayList<>();
Set<String> stringSet = new HashSet<>();
int number = AllFunctions.scannerInt();
for (int i = 0; i < number; i++) {
stringList.add(AllFunctions.scannerString());
}
}`
//I don't understand how to finish the code using Stream
//I'm full