Description:
Task 2 states that List<String> of unique names must be returned, but ordering is not specified.
The issue can be replicated by taking the right solution:
public List <String> task2 (List <String> names) {
List<String> result = new ArrayList<>(List.copyOf(Set.copyOf(names)));
return result;
}
Which passes the tests and then applying Collections.shuffle() to it, like this:
public List <String> task2 (List <String> names) {
var result = new ArrayList<>(List.copyOf(Set.copyOf(names)));
Collections.shuffle(result);
return result;
}
The resulting solution must pass tests according to the statement, but it doesn't.
Description:
Task 2 states that
List<String>of unique names must be returned, but ordering is not specified.The issue can be replicated by taking the right solution:
Which passes the tests and then applying
Collections.shuffle()to it, like this:The resulting solution must pass tests according to the statement, but it doesn't.