Let's say I have two arrays,
String[] A= {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
String[] B= {"0", "2", "4", "6", "8", "10", "12"};
How can I compare the two arrays, in a way that I want to return another array with all the values of A that are in B?
Returning array:
String[] C= {"2", "4", "6","8","10"};
I read this stackoverflow question which essentially, is asking the same thing - but would like to know what the equivalent is, in Java
C# code from answer:
string[] a1 = { "A","B", "C", "D" };
string[] a2 = { "A", "E", "I", "M", "Q", "U" ,"Y" };
string[] result = a1.Where(a2.Contains).ToArray();