I'm looking for the best way to check if an Array of primitives contains all of the primitives in another Array in Java. For instance:
int[] a = new int[]{1,2};
int[] b = new int[]{1,2,3,4,5};
int[] c = new int[]{2,4,6};
containsAll(b, a); //true
containsAll(a, b); //false
containsAll(c, b); //false
Where containsAll is a function that check if inside the first parameter there is the second parameter!!! I don't want to convert my arrays of int in arrays of Integer in order to use the following method:
Arrays.asList(a).containsAll(Arrays.asList(b))
Because I think that if the arrays are huge, it would be a big waste of performance!!! But maybe I'm wrong and the best solution is that one... Have you got any idea?