I have a model class for my company which has numbers.  I would like
to create a method like

getNumbers()

which returns all of the different phone numbers that are in the
database as a collection.  However, when I get them, I need to know
which ones they are for display purposes (just a list of numbers
won't do much good or else you end up calling a fax machine).  I
thought of using a HashMap like

HashMap numbers = new HashMap();
numbers.put("phone", getPhone());
numbers.put("fax", getPhone());

etc.

but then I realized that HashMaps screw up the order.  I need to
keep the order that I place them in the Hash so I can do

<c:forEach items="${company.numbers}" var="number">
    <bean:message key="${number.key}"/>: <c:out value="${number.value}"/>
</c:forEach>

I tried to implement a FifoMap but failed because I didn't know how
to subclass Map.Entry

POSSIBLE SOLUTION:

I guess the solution would be to create a Bean for a Phone Number
and then have getNumbers() return a Collection of phone number
beans.  Is that the best way or is a map still possible?

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
"I'm old enough to know better, but still too young to care."
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to