This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes List to HashMap? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "List to HashMap?" Watch "List to HashMap?" New topic

List to HashMap?

Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
I have a method which presently returns a List.

Now my method needs to return (account, status) instead of just account.

I am thinking I need to change the method to return hashmap instead of list.

Can anyone suggest me better solution?

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37884
Sounds like a beginner's question . . .
Can you incorporate status and account into a single object?
Joanne Neal

Joined: Aug 05, 2005
Posts: 3415
What sort of object is account ? Can you not add a status field to it ?

I agree. Here's the link:
subject: List to HashMap?
Similar Threads
Generics Implementation in Java SE 5
search for a value within list of HashMaps
PMD: LooseCouplingRule, what does this REALLY mean?
Would a HashSet be a way to solve this problem?
Too many methods