I am trying to compare input with values in an arraylist.
public compare(number)
Ex; I have an arraylist:
[100,1102,14051,1024, / 142,1450,15121,1482,/ 141,1912,14924,1001] // the / represents each entry
Each index of the array represents a unique attribute in my program. e.g index 0 represents user id, index 1 represents room number etc.
If I do arraylist.get(2) it returns the second array (142,1450,15121,1482).
I'm trying to compare number to the 2nd element in each array.
So say I run this compare(1102), I want it to iterate through each [1] in each array, and return true if there is a match at that index.
So I want it to compare the 'number' (1102) with each 1st index element (1102,1450,1912) and because 1102 is in the arraylist, return true
I've been searching around and couldn't find how to implement this, or word the question in the right way
arraylist.get(0)gives you anArrayList, you can then use anotherget()to access the individual element (e.g.arraylist.get(0).get(0)will give you the first element of the first list)