Make code more idiomatic (#4249)

This commit is contained in:
Ranjeet Kumar Jena
2023-07-23 16:21:52 +05:30
committed by GitHub
parent b1ba262b64
commit 1afc4cc319
9 changed files with 22 additions and 28 deletions

View File

@ -76,11 +76,7 @@ public class KnightsTour {
return false;
}
Collections.sort(neighbor, new Comparator<int[]>() {
public int compare(int[] a, int[] b) {
return a[2] - b[2];
}
});
neighbor.sort(Comparator.comparingInt(a -> a[2]));
for (int[] nb : neighbor) {
row = nb[0];