uzyskaj unikalne wyniki dopasowywania wyrażeń regularnych (bez używania map lub list)

Czy istnieje sposób, aby uzyskać tylko unikalne mecze? bez użycia listy lub mapy po dopasowaniu chcę, aby wyjście matchera było od razu unikalne.

Przykładowe wejście / wyjście:

String input = "This is a question from [userName] about finding unique regex matches for [inputString] without using any lists or maps. -[userName].";
Pattern pattern = Pattern.compile("\\[[^\\[\\]]*\\]");
Matcher matcher = pattern.matcher(rawText);
while (matcher.find()) {
    String tokenName = matcher.group(0);
    System.out.println(tokenName);
}

Spowoduje to wyświetlenie następujących informacji:

[userName]
[inputString]
[userName]

Ale chcę, aby wyświetlał następujące informacje:

[userName]
[inputString]

questionAnswers(1)

yourAnswerToTheQuestion