其他分享
首页 > 其他分享> > Collection的几个方法

Collection的几个方法

作者:互联网

 

Collection coll = new ArrayList();
coll.add(123);
coll.add(456);
Collection coll1 = new ArrayList();
coll1.add(123);
coll.removeAll(coll1);
System.out.println(coll);

 

        Collection coll = new ArrayList();
        coll.add(123);
        coll.add(456);
        Object[] objects = coll.toArray();
    List objects1 = Arrays.asList(objects);

 

        List ints = Arrays.asList(new int[]{123, 456});
        System.out.println(ints);
        //输出:[[I@28d93b30]
        List ints1 = Arrays.asList(new Integer[]{123, 456});
        System.out.println(ints1);
        //输出:[123, 456]    

 

标签:几个,add,456,coll,Collection,coll1,new,方法
来源: https://www.cnblogs.com/Boerk/p/15656378.html