String withoutBrackets = List.of("a", "b").toString() .replaceAll("[]\\[]", ""); System.out.println(withoutBrackets );
//output: a, b