I am new to Java. I have created an arraylist of objects of custom class. Objects of the class contain private variables like firstName, lastName, etc. and public getters and setters to access it and set it.
I wanted to loop through the arraylist to check if firstName in any of the objects in the indexes of arraylist matches the name entered by user. How do I check that?
I know that the get(i) method when used on arraylist returns the element in the specific index. But I don’t want the complete object. I want the variable inside the object.