public?static?void?main(String[]?args)?{
ListInteger?listA?=?Arrays.asList(A);
ListInteger?listB?=?Arrays.asList(B);
ListInteger?jiaoji?=?new?ArrayListInteger();
for(Integer?a:listA){
if(listB.contains(a)){
jiaoji.add(a);
}
System.out.println(jiaoji);
ListInteger?bingji?=?new?ArrayListInteger();
if(!bingji.contains(a)){
bingji.add(a);
for(Integer?b:listB){
if(!bingji.contains(b)){
bingji.add(b);
System.out.println(bingji);
ListInteger?chaji?=?new?ArrayListInteger();
if(!listB.contains(a)){
chaji.add(a);
System.out.println(chaji);
public class PlayCard {
private ListInteger list;
/**
*/
public PlayCard() {
list = new ArrayListInteger();
list.add(i);
public void showPlayCard(){
System.out.println("方式一");
for(Integer i : list){
System.out.print(i+"\t");
System.out.println("方式二");
for(int i=0;ilist.size();i++){
System.out.print(list.get(i)+"\t");
System.out.println("方式三");
Iterator Integer it = list.iterator();
while(it.hasNext()){
System.out.print(it.next()+"\t");
public void randomPlayCards(){
// 把牌打乱
Collections.shuffle(list);
public static void main(String[] args) {
PlayCard p = new PlayCard();
p.randomPlayCards();
p.showPlayCard();
SetCharacter result = new HashSetCharacter();
SetCharacter set1 = new HashSetCharacter() {
{
add('a');
add('b');
add('c');
add('d');
add('e');
};
result.clear();
result.addAll(set1);
System.out.println("交集:" + result);
System.out.println("差集:" + result);
System.out.println("并集:" + result);
System.out.println("补集:"+result);
}else{
System.out.println("无补集");
以上就是土嘎嘎小编为大家整理的集合java编程代码相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!