寻找从多个列表中进行选择的方法,其中所有列表中都存在值。
int arr[] = new int[2];
if(array.length==0){
arr[0] = array2[0];
arr[1] = array2[1];
}
else if(array.length==1){
arr[0] = array[0];
arr[1] = array2[1];
}
else if(array.length==2){
arr[0] = array[0];
arr[1] = array[1];
}
else{
System.out.println("no");
}
System.out.println(arr[0]);
System.out.println(arr[1]);
鉴于以下输入,我想检索所有列表中存在的整数。
public class A {
public List<B> BList {get;set;}
}
public class B {
public string Key {get;set;}
public List<int> IntegerList {get;set;}
}
我基本上希望能够在给定无限数量的整数列表的情况下检索新列表{1,2},因为这些值都出现在所有列表中。