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