Home > Back-end >  Save the children! Arrays. Sort (pairs (a, b) -> ([0] a [0] - b)); How to understand this code?
Save the children! Arrays. Sort (pairs (a, b) -> ([0] a [0] - b)); How to understand this code?

Time:09-21

Pais is a two-dimensional array int [] [], so the Arrays. Sort (pairs (a, b) - & gt; ([0] a [0] - b)); This sentence is how to sort? Consult everybody

CodePudding user response:

Lambda expressions

CodePudding user response:

Lambda expressions

CodePudding user response:

Go to the help documents

CodePudding user response:

The
references the building Lord reply me five years old:
pais is a two-dimensional array int [] [], so the Arrays. Sort (pairs (a, b) - & gt; ([0] a [0] - b)); This sentence is how to sort? Consult everybody


 
The Arrays. Sort (pairs, new Comparator@ Override
Public int the compare (Integer [] a, Integer [] b) {
Return a [0] - b [0];
}
});

CodePudding user response:

reference 4 floor qq_39936465 response:
Quote: refer to the original poster I five years old response:

Pais is a two-dimensional array int [] [], so the Arrays. Sort (pairs (a, b) - & gt; ([0] a [0] - b)); This sentence is how to sort? Consult everybody


 
The Arrays. Sort (pairs, new Comparator@ Override
Public int the compare (Integer [] a, Integer [] b) {
Return a [0] - b [0];
}
});


Thank you bosses, explain very clear, but I tried, is defined as should use int, not with Integer ~
  • Related