java - Finding and showing element in arraylist -
is there easy way search through arraylist? see there many things collections removeall() , add() there searching through list
add method userarchive
class loops through list , compares each user id 1 passed in.
public user findbyid(int id) { (user u : list) { if (u.getcustomerid() == id) { return u; } } return null; // or empty user }
Comments
Post a Comment