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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -