求助一个关于sort的问题
java吧
全部回复
仅看楼主
level 12
Michael解 楼主
如何给一个Point2D的List按照X的大小排序。。
2013年10月03日 09点10分 1
level 12
Michael解 楼主
Collections.Sort()不能用于Point2D的List
2013年10月03日 09点10分 2
level 12
Michael解 楼主
我建了一个新的ArrayList专门放X的值,然后用Collection.sort,再用原来的List按照这个来排序
2013年10月03日 09点10分 3
level 12
Michael解 楼主
可是这样再重新排序的时候需要一个for循环套一个for循环,会慢很多。。
2013年10月03日 09点10分 4
level 12
Michael解 楼主
然后想不出,其他的办法了。。
2013年10月03日 09点10分 5
level 12
Michael解 楼主
所以求助各位大神,怎么在不自己写一个方法的情况下给Points2D的List排序。。
2013年10月03日 09点10分 6
level 12
Michael解 楼主
呼叫大神,呼叫大神。。
求不秒沉。。
2013年10月03日 09点10分 7
level 12
Michael解 楼主
木有人么。。
2013年10月03日 09点10分 8
level 1
Collections.sort(List, Comparator),自己实现一下 Comparator 接口就能用了。
2013年10月05日 07点10分 9
level 11
楼上正解。
2013年10月05日 07点10分 10
1