ArrayList去重方法:
不想用for循环的方法去重,那么可以先考虑把ArrayList转化为一个临时的HashSet,再把这个临时的HashSet转化回ArrayList(HashSet里面的元素是不可重复的)
代码:
HashSet<Crmmenu> hashset_temp = new HashSet<Crmmenu>(menuList);
menuList = new ArrayList<Crmmenu>(hashset_temp);
ArrayList去重方法:
不想用for循环的方法去重,那么可以先考虑把ArrayList转化为一个临时的HashSet,再把这个临时的HashSet转化回ArrayList(HashSet里面的元素是不可重复的)
代码:
HashSet<Crmmenu> hashset_temp = new HashSet<Crmmenu>(menuList);
menuList = new ArrayList<Crmmenu>(hashset_temp);