java - How to store multi parameters in a list? -


i want know how can save different parameters related 1 key in single list.

for example imagine have list of people have name, family name, salary , key find unique person in list.

what can use store these information in single list?

what structures can use? list, array list, hash map, map, set etc.

do have define new class?

you should define person class having properties mentioned. can store people in map<integer,person> or map<string,person>, depending on whether unique identifier of person integer or string.

if use hashmap implementation of map, you'll able locate person identifier key in expected constant time.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -