Given a filtered string. I want to add its substrings to an ArrayList only if it doesn't contain it already.
My code:
Pattern reg = Pattern.compile(",");
ArrayList<String> SANR = reg.splitAsStream(joiner.toString())
.filter(role -> role.contains("ABB"))
.map(str -> str.replaceAll("ABB", ""))
.collect(Collectors.toCollection(ArrayList::new));
As input, it gets all the values with ABB appended such as [123,123,244,244,255], so I want to make sure the output is just:
[123,244,255]