Set to array:
Long[] s=null;
for (CommodityType commodityType : commodityTypeList) {
tt.add(commodityType.getSupplyType().getId());
s=(Long[]) Array.newInstance(Long.class, att .size());
for (int i = 0; i < s.length; i++) {
s[i]=Long.parseLong(Long.toString(commodityType.getSupplyType().getId()));
break;
}
}
if (Arrays.equals(s, supplyTypeIds)) { //Compare
System.out.println("The elements in the two arrays have the same value");
} else {
System.out.println("The elements in the two arrays The values are not the same");
}
Compare the values in the two lists for equality:
Long[] supplyTypeIds={1,2,3,4,3,4};
List list = Arrays.asList(supplyTypeIds);//Array to set
for (int i = 0; i < att.size(); i++) {
if(!list.contains(att.get(i))){/ /comparison for equality
}
}
Comparing two arrays Comparing two sets
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326508465&siteId=291194637
Recommended
Ranking