java - Understanding sorting multidimensional array with comarator -
I am the second column "[] [2]" I want to sort all [13] from the third value.
int myNum = 0; Arrays.sort (cat, new comparative & lt; string [] & gt; () {@ override public int comparison (final string [] entry 1, last string [] entry 2) {last string e1 = entry1 [1]; Last string e2 = entry2 [1]; return e1.compareTo (e2);}}); (The last string [] s: cat) {System.out.println ("sorting:" + s [0] + "" + s [1] + "+ s [2] +" "+ s [3] ); {try myNum = Integer.parseInt (s [2]);} Hold (Number Format Expo Enough) {System.out.println ("+ nfe could not be parsed)";} If (Minom> 3 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp;; amp; amp; amp; amp;; [1]; equals ("1") {moreValues2.add (s [1]); moreURLS2.add (s [3]);}} pre> How do I choose to type in my code above it is sorted by the first column, but I want to sort by the third. I'm not sure that How to modify and why to modify it.
I have not got any profit and version 7
In your comparator, values have been taken here:
last string e1 = entry1 [1]; last string e2 = entry 2 [1]; [2], or [ 3] with [1] easily change [1] (because I do not have "third value in second column").
Comments
Post a Comment