java中对List对象集合进行排序

//companys 是一个List对象集合
Collections.sort(companys, new Comparator() {
			public int compare(Object a, Object b) {
				Long one = ((UserCompany) a).getCompany().getComid();
				Long two = ((UserCompany) b).getCompany().getComid();
				return (int) (one - two);
			}
		});

  

posted @ 2013-03-14 16:18  宁静致远_  阅读(3192)  评论(0编辑  收藏  举报