2个阵列的差异 [英] difference of 2 arrays
问题描述
我有两个阵列,我正在尝试创建一个第三个阵列,这是两个阵列之间的区别
Ex:
arrayA:3 5 8 9
arrayB:3 4 6 9
的差异:5 8
但是,我的代码只是给我一个0'的数组
我试图使用我的搜索方法(已经过测试和工作)从中获取一个数字第一个数组并在另一个数组中搜索它。如果找不到,则搜索方法返回0,然后将第一个数组中的数字存储到第3个数组中。
这里是我的代码部分,我是不确定是什么问题。
I have two arrays and I''m trying to create a 3rd array that is the difference between the two arrays
Ex:
arrayA: 3 5 8 9
arrayB: 3 4 6 9
difference of A-B: 5 8
however, my code is just returning me an array of 0''s
im trying to use my search method (which has been tested and works) to take a number from the first array and search it in the other array. If it is not found the search method returns a 0 and the number from the first array is then stored into the 3rd array.
here is the portion of my code, I''m not sure what is wrong.
推荐答案
@ cmb3587
根据你所说的区别逻辑?
@cmb3587
On the basis of which logic you are saying the difference ?
@dmjpro
从普通集理论来看:AB是A中不在B中的所有元素。
亲切的问候,
Jos
@dmjpro
From ordinary set theory: A-B are all elements in A that are not in B.
kind regards,
Jos
为什么不看一下ArrayList类,看看你可以用它来表达什么魔力?
Why not have a look at the ArrayList class and see what magic you can conjure up with it?
这篇关于2个阵列的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!