Search an ArrayList for a particular Object

前端 未结 6 835
陌清茗
陌清茗 2021-01-21 07:05

I have a class called Person. It has the following attributes; It has 2 attributes, ID, and Telephone. 1 person can have many

6条回答
  •  鱼传尺愫
    2021-01-21 07:34

    Use a for loop to iterate through the list. In the body of the loop, check if the telephone number of the person in the list is the telephone number you're looking for. If yes, then return the person.

    See The for Statement in Oracle's Java Tutorials.

提交回复
热议问题