用一个内隐类(LIST1)就可以了:

解决方案 »

  1.   

    List temp = list2.remove(list1)
      

  2.   

    list2.retainAll(list1);返回的是布尔型我要的是List型呀请问怎样返回List型呀 
    List temp = list2.remove(list1)语法调试不通
    请问还有什么办法呀谢谢
      

  3.   

    list2.retainAll(list1);已经是将list2中的元素去掉啦。list2就是结果
    如果你需要得到另外一个list
    可以ArrayList al = new ArrayList(list2);
    al.retainAll(list1);
      

  4.   

    List temp = list2.remove(list1)
      
     
    错了吧retainAll是正解,根据情况,选择是否要保存list2的原始数据