package andmevood; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class Fail6 { public static void main(String[] args) throws IOException{ BufferedReader sisse=new BufferedReader(new FileReader("isikud.txt")); PrintWriter valja=new PrintWriter(new FileWriter("vastus2.txt")); sisse.lines().map(s -> s.split(" ")). map(rida -> new Paar(rida[0], Integer.parseInt(rida[1]))). sorted((k1, k2) -> k1.kysiTeine()-k2.kysiTeine()). forEach(valja::println); sisse.close(); valja.close(); } }