Вот другой подход:
//read file into stream, try-with-resources
try (Stream<String> stream = Files.lines(Paths.get("result.txt"))) {
stream.map(line -> line.split("\\s"))
.map(a -> new Players(a[0], a[1], Integer.parseInt(a[2])))
.collect(groupingBy(Players::getAttemps))
.entrySet().stream().min(Comparator.comparingInt(Map.Entry::getKey))
.map(Map.Entry::getValue)
.map(l -> l.size() > 1 ?
l.stream().map(Players::getName)
.collect(joining(", ","there is a tie -->",
"with "+ l.get(0).getAttemps()+"attempt(s)!")) :
"The winner is: " + l.get(0).getName() +
"with "+ l.get(0).getAttemps() +"attempt(s)!")
.ifPresent(System.out::println);
} catch (IOException e) { e.printStackTrace(); }
Это обрабатывает оба случая, когда есть только один победитель, или когда есть ничья, и отображает соответствующие сообщения для каждого.
import:
import static java.util.stream.Collectors.*;
import java.util.stream.*;
import java.util.List;
import java.util.*;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.io.*;