hashmap which has 5 storage area for every index.
I want to store 5 seperate datas for every hashmap index... And if i write a data strorage class and save every instance to the hashmap, is it logical and fast enough?
For example:
HashMap.Put("mystorage1",new Store5Data(data1,data2,data3,data4,data5))
If this way is not ok how can i implement this with the ready classes or packages?
Thank you
[376 byte] By [
netsonicca] at [2007-11-27 11:32:22]

> It should work, but I would think a simple array
> would be enough.
I'd probably plump for the OP's idea, but it depends on how fixed and concrete the "5 elements" requirement is, and the meaning of those elements. It may well make sense that those 5 elements comprise a single object
single array wont be enough because i sure wont have only 1 index for example ... I will store 100 hashmap indexes and totally 5*100=500 stored datas.
> @Op. Use a custom class and give the attributes
> logical names.
What do you mean?
> single array wont be enough because i sure wont have
> only 1 index for example ... I will store 100 hashmap
> indexes and totally 5*100=500 stored datas.
>
> > @Op. Use a custom class and give the attributes
> > logical names.
>
> What do you mean?
Just what you said in your first post, but I wouldn't name the attributes data1, data2 etc if they could be given better names. What do they represent?
Kaj
kajbja at 2007-7-29 16:45:05 >

The attiribute names was just an example.
I will define this mapping for the servlet front controller. HashMap will be static final and all variables will be predefined as static final when the application starts.
I will make urlrewriting and flood control by this mechanism
Hashmap index will be the url pattern defined in web.xml Exmp:if url is www.mydomain.com/photos/432 hashmap index value will be photos
Data1=the jsp file where photos will refer to
Data2=the parameter where 432 is owned by. For exmp ?id=432
Data3=another parameter maybe
Data4=Servlet processing heavyness. It means when a servlet has value 1 its the minimum heavyness and if 5 its te most heavyness.When calling servlets frequently i will make session based flood control acoording to this value.
Data5=there may be something else...
I am implementing this and i will just fetch datas from hashmap. Inserting is just for one time at the begining of the application