/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.stream.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
"Mark,10,0,34" ,
"Tom,2,7,19" ,
"Billy,2,0,7"
)
);
inputs
.stream()
.
sorted( ( String s1 ,
String s2
) -> Integer.
valueOf( s1.
split( "," )[ 3 ] ).
compareTo( Integer.
valueOf( s2.
split( "," )[ 3 ] ) ) ) .collect( Collectors.toList()) ; // In Java 16+: .toList();
System.
out.
println( "sorted = " + sorted
);
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgppbXBvcnQgamF2YS51dGlsLnN0cmVhbS4qIDsKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgogICAgICAgIExpc3QgPCBTdHJpbmcgPiBpbnB1dHMgPQogICAgICAgICAgICAgICAgbmV3IEFycmF5TGlzdCA8PigKICAgICAgICAgICAgICAgICAgICAgICAgTGlzdC5vZigKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTWFyaywxMCwwLDM0IiAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlRvbSwyLDcsMTkiICwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQmlsbHksMiwwLDciCiAgICAgICAgICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgICk7CgogICAgICAgIExpc3QgPCBTdHJpbmcgPiBzb3J0ZWQgPQogICAgICAgICAgICAgICAgaW5wdXRzCiAgICAgICAgICAgICAgICAgICAgICAgIC5zdHJlYW0oKQogICAgICAgICAgICAgICAgICAgICAgICAuc29ydGVkKCAoIFN0cmluZyBzMSAsIFN0cmluZyBzMiApIC0+IEludGVnZXIudmFsdWVPZiggczEuc3BsaXQoICIsIiApWyAzIF0gKS5jb21wYXJlVG8oIEludGVnZXIudmFsdWVPZiggczIuc3BsaXQoICIsIiApWyAzIF0gKSApICkKICAgICAgICAgICAgICAgICAgICAgICAgLmNvbGxlY3QoIENvbGxlY3RvcnMudG9MaXN0KCkpIDsgLy8gSW4gSmF2YSAxNis6IC50b0xpc3QoKTsgCgogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbiggInNvcnRlZCA9ICIgKyBzb3J0ZWQgKTsKICAgICAgICAKCX0KfQ==
sorted = [Billy,2,0,7, Tom,2,7,19, Mark,10,0,34]