collection方法介绍
Collection
<Object> ajj
=new ArrayList<>();
boolean f
= ajj
.add("aa");
System
.out
.println(ajj
);
System
.out
.println(f
);
System
.out
.println(ajj
);
Collection
<Object> ajj
=new ArrayList<>();
Collection
<Object> coll
=new ArrayList<>();
coll
.add("aa");
coll
.add("bb");
coll
.add("cc");
coll
.add("dd");
coll
.add("ee");
coll
.add("ff");
System
.out
.println(ajj
);
System
.out
.println(coll
);
boolean f1
=ajj
.addAll(coll
);
System
.out
.println(f1
);
System
.out
.println(ajj
);
System
.out
.println(coll
);
Collection
<Object> coll
=new ArrayList<>();
coll
.add("aa");
coll
.add("bb");
coll
.add("cc");
coll
.add("dd");
coll
.add("ee");
coll
.add("ff");
System
.out
.println(coll
);
coll
.clear();
System
.out
.println(coll
);
Collection
<Object> coll
=new ArrayList<>();
coll
.add("aa");
coll
.add("bb");
coll
.add("cc");
boolean f2
=coll
.contains("aa");
System
.out
.println(f2
);
Collection
<Object> ajj
=new ArrayList<>();
Collection
<Object> coll
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
coll
.add("aa");
coll
.add("bb");
coll
.add("cc");
coll
.add("dd");
coll
.add("ee");
coll
.add("ff");
boolean f3
=ajj
.containsAll(coll
);
System
.out
.println(f3
);
Collection
<Object> ajj
=new ArrayList<>();
Collection
<Object> coll
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
coll
.add("aa");
coll
.add("bb");
coll
.add("cc");
coll
.add("dd");
coll
.add("ee");
coll
.add("ff");
boolean f4
=ajj
.equals(coll
);
System
.out
.println(f4
);
Collection
<Object> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
int hashCode
=ajj
.hashCode();
System
.out
.println(hashCode
);
Collection
<Object> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
boolean f4
=ajj
.isEmpty();
System
.out
.println(f4
);
Collection
<Object> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
Iterator
<Object> iterator
= ajj
.iterator();
Collection
<String> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
System
.out
.println(ajj
);
boolean f5
= ajj
.remove("aa");
System
.out
.println(f5
);
System
.out
.println(ajj
);
Collection
<Object> ajj
=new ArrayList<>();
Collection
<Object> coll
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("aa");
ajj
.add("aa");
ajj
.add("ee");
ajj
.add("hh");
ajj
.add("vv");
ajj
.add("22");
ajj
.add("ff");
coll
.add("aa");
coll
.add("bb");
coll
.add("cc");
coll
.add("dd");
coll
.add("ee");
coll
.add("ff");
System
.out
.println(ajj
);
System
.out
.println(coll
);
boolean f6
=ajj
.removeAll(coll
);
System
.out
.println(f6
);
System
.out
.println(ajj
);
System
.out
.println(coll
);
Collection
<Object> ajj
=new ArrayList<>();
Collection
<Object> coll
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("aa");
ajj
.add("aa");
ajj
.add("ee");
ajj
.add("hh");
ajj
.add("vv");
ajj
.add("22");
ajj
.add("ff");
coll
.add("aa");
coll
.add("bb");
coll
.add("cc");
coll
.add("dd");
coll
.add("ee");
coll
.add("ff");
System
.out
.println(ajj
);
System
.out
.println(coll
);
boolean f7
=ajj
.retainAll(coll
);
System
.out
.println(f7
);
System
.out
.println(ajj
);
System
.out
.println(coll
);
Collection
<Object> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
int size
=ajj
.size();
System
.out
.println(size
);
Collection
<Object> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
Object
[] arr
= ajj
.toArray();
for (Object o
: arr
) {
System
.out
.println(o
);
}
Collection
<Object> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
Object
[] arr
= ajj
.toArray();
for (Object o
: arr
) {
System
.out
.println(o
);
}
Collection
<String> ajj
=new ArrayList<>();
ajj
.add("aa");
ajj
.add("bb");
ajj
.add("cc");
ajj
.add("dd");
ajj
.add("ee");
ajj
.add("ff");
String
[] str
=new String[ajj
.size()];
Object
[] arr
= ajj
.toArray(str
);
for (Object o
: arr
) {
System
.out
.println(o
);
}
转载请注明原文地址: https://yun.8miu.com/read-109319.html