The linear method in post #1 is an example of code that searches through the elements in an arrray of objects and returns the index to an element in the array. The code that tests for the match...
Type: Posts; User: Norm
The linear method in post #1 is an example of code that searches through the elements in an arrray of objects and returns the index to an element in the array. The code that tests for the match...
The method in post #1 returns the value of the index where the matching Contact object was found.If you called it like this:
int theIndex = linear(guys, "The name to match");
Then you could use...
Do you know how to add a method to the Contact class? What do you want to compare or test that is in the Contact object against the value of the variable: target?
Return true if its a match and...
What you show is NOT an array of Strings. Its an array of Contact class objects.
The Contact class could have a method that could take an arg(s) and say if that instance of the class matches...