Re: question



Lew wrote:

Daniel Moyne wrote:
Now regarding you proposal which is neat though it does not allow for the
ArrayList [sic] to be used in another method of the class as actually
required in my work ; the example provided here was only meant to
understand the way the put action was working regarding the list value of
the map with different options ; of couse the Map created in sued in
another method in my work.

Since the ArrayLists (plural!) are in the Map, you retrieve them from the
Map.
The variable in question will not be in scope in another method anyway,
so
your reasoning is not applicable. It also will hold only /one/ of the
Lists; how do you figure on retrieving the others?
sorry but I need the ArrayList pointer to be known for some specific process
for some particular reasons and the call to this method is made in the
first loop of my example but is not provided here as this method was not
necessary to explain my particular problem.
And you haven't answered why the map is
Map <Integer, ArrayList <<String>>
instead of
Map <Integer, List <Integer>>
. Why is it so necessary to store Strings in the List, and ArrayLists in
the Map?

Again Lew the code provided he is not the whyole code of my application ; it
is only somehow just alike to clearly expose my problem which was
successful done as the readers have provided the fix ; in this context the
whole code was not relevant ; in my acctual application I am reading
strings in a text file line by line ; each line contains strings separated
by coma ; when I read the file I store the strings in an ArrayList and this
ArrayList as the value of the map record with the line number as the key.

I store the strings for later process that I do not want to initiate unless
whole data of my file is proved to be correct (data is supposed to have
some particular meaning) ; if the data is ok then I proceed by iterating
the map basically loop 2 of my example.
Daniel.

--
Daniel Moyne
(Nulix)---------------------------------------------------------
Distribution : Ubuntu Feisty \\|||// Machine : x86_64
kernel 2.6.20-16-generic / --- \ ATI Radeon X300
KDE 3.5.7 (' o-o ')
----------------------------------------oOO-(_)-OOo--------------------------
.



Relevant Pages

  • Re: question
    ... Why is it so necessary to store Strings in the List, and ArrayLists in ... strings in a text file line by line; ... ArrayList as the value of the map record with the line number as the key. ...
    (comp.lang.java.help)
  • Re: question
    ... Why is it so necessary to store Strings in the List, and ArrayLists ... Daniel Moyne wrote: ... ArrayList and this ArrayList as the value of the map record with the line ...
    (comp.lang.java.help)
  • Re: question
    ... of couse the Map created in sued in another method in ... Since the ArrayLists are in the Map, you retrieve them from the Map. ... It also will hold only /one/ of the Lists; how do you figure on retrieving the others? ...
    (comp.lang.java.help)
  • Re: how to use a STL map?
    ... > I want to use a map to store a list of strings and i dont want a duplicate ... how can I go about this using the STL map? ...
    (comp.programming)
  • Re: how to use a STL map?
    ... > I want to use a map to store a list of strings and i dont want a duplicate ... how can I go about this using the STL map? ...
    (comp.lang.cpp)