mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-23 12:35:55 +08:00
Make code more idiomatic (#4249)
This commit is contained in:

committed by
GitHub

parent
b1ba262b64
commit
1afc4cc319
@ -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];
|
||||
|
Reference in New Issue
Block a user