== The days of the week and index ==
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   laeticia_corlean
Posted On:   Friday, October 4, 2002 01:55 AM

Hi, I have created a serie of beans that holds the days of the week (e.g. Monday, Thuersday ... etc ...) in different locals (e.g. French, English, Spanish ... ) Now I would like to create a getter method that would return an object as follow: index | label ----------------- 1 | Lundi 2 | Mardi 3 | Mercredi 4 | Jeudi 5 | Vendredi 6 | Samedi 7 | Dimanche Note that the index starts at 1, not 0 (I have this requirement for a web application) - For this reason I cannot use a ArrayList for instance. I was thinking about a Hashtable    More>>

Hi,


I have created a serie of beans that holds the days of the week (e.g. Monday, Thuersday ... etc ...) in different locals (e.g. French, English, Spanish ... )


Now I would like to create a getter method that would return an object as follow:



index | label

-----------------

1 | Lundi

2 | Mardi

3 | Mercredi

4 | Jeudi

5 | Vendredi

6 | Samedi

7 | Dimanche



Note that the index starts at 1, not 0 (I have this requirement for a web application) - For this reason I cannot use a ArrayList for instance.

I was thinking about a Hashtable but the problem is that put() tacks 2 Object objects (one for the key, one for the value) and I would the key to be an int. I would also avoid to use the Integer wrapper because of it overheads and the tricky way we have to retreive the value as a int.



Thanks

   <<Less

Re: == The days of the week and index ==

Posted By:   eimi_nos  
Posted On:   Friday, October 4, 2002 02:59 AM

Can this solve your problem?

String[] semana = {domingo, lunes, martes, miercoles, jueves, viernes, sabado, domingo};
About | Sitemap | Contact