我有这个字符集流:
Stream<Set<Character>> characterSet
现在,我想将此流转换为简单的字符集,然后执行以下操作:
Set<Character> newSet = characterSet.collect(Collectors.toSet());
但是,我收到此错误:
Incompatible types. Required Set<Character> but 'collect' was inferred to R: no instance(s) of type variable(s) exist so that Set<Character> conforms to Character inference variable T has incompatible bounds: equality constraints: Character lower bounds: Set<Character>.
我该如何解决?谢谢!
如下进行:
输出: