ArrayList相当于数组,不能直接去除重复值,就如bluesmile979(笑着) 说的,可以用hashset,或者自己写一个方法实现

解决方案 »

  1.   

    同上,ArrayList不能去掉重复值,还是用set吧
      

  2.   

    有的集合类里是自动去掉重复的
    例如set
      

  3.   

    那么再问一句hashset怎么去掉重复?
      

  4.   

    list相当于数组,set相当于集合。
    数组中可以存在重复,集合中没有。
      

  5.   

    yes, you can insert the value into that and then for usage, you can get an interator. But you can't get rid of those duplicated values in arraylist, as more or less it is considered to be a variable-length array type