DEV Community

Discussion on: Remove Duplicate Characters from given string(Java)

Collapse
 
jingxue profile image
Jing Xue

If you are allowed to use streams, this would do:

Stream.of(str.toCharArray()).collect(Collectors.toSet()).stream().collect(Collectors.joining())
Enter fullscreen mode Exit fullscreen mode