What I would like to do is have one array compare itself to another array and if it finds a duplicate in the comparing array it will skip the following statement, here is what I've got at the moment
for (int count=0; count < userId.length; count++) {
for (int integer=0; userId[count] != excluded[integer]; integer++) {
// The arrays hold either string or Long variables in them
// Continued code to finish off after checking array
}
}
what I want to do is get this to work, however possible but keep it as simple as possible at the same time. incase the code is actually not clear at all I want to compare two arrays userId and excluded, and what I want is that if any of the userId values in the array match any in excluded then like the array states I want to exclude them from the list.
EDIT:
when running if (excluded[counts].contains(user))
I get the specific output I wanted "GREAT!"
but the problem I have now is if I run the if as if (!excluded[counts].contains(user))<br>
I get the excluded values and then some, many of the values repeat minus those that show
Example:
String[] userId = new String [] { "10", "15", "17", "20", "25", "33", "45", "55", "77" }
String[] excluded = new String[] { "15", 20", "55", "77" }
then I get to my loop to check the arrays
int count=0;
for (String user : userId) {
for (int counts=0; counts < excluded.length; counts++) {
if (!excluded[counts].contains(user)) {
System.out.println("UID = " + userID[count]);
}
count++
that !excluded will still show instances of the userId that I don't want to be shown, so it still shows "UID = 15" even though I want it to exclude it, which it does, but only once so instead of seeing it 4 times I see it 3 times.
userIdbut not inexcluded?