Hi
The straight right way to do it is to create your own List, like :
List<String> oneColumnList = new LinkedList<String>();
The populate it with the things you need from the first List, something
like this (I don't know the names of the methods in the Column class,
and I dont't think the "for each" construct will work, but you've got
the idea) :
for ( Column c : myFirstList ) {
oneColumnList.add( c.getFirstColumn());
}
Then call the 2nd function with the newly constructed list.
Of course, this is a silly way to do it, specially when the number of
columns is important. The alternative is to find a library function or
some other solution to get directly a list of columns.
Hope it helps
Mihai
Le 19/02/2011 13:04, asil klin a écrit :
I have a function that returns a list like this:-
|List <Column <String1, String2>>|
Next I want to pass this list to a 2nd function, but 2nd function just
needs a list which contains only 1st part (string1) of the Column(s)
of the above list.
So I want pass just this list to 2nd function:-
|List <String1>|
What would be the best way to do this ??
** [my use case: Both the functions are from a library that I use to
access database(Cassandra) for a web application. 1st function gives
me a list of all columns which has two parts name(String1) and
value(String2). So 1st function gives me a list of all columns(each of
which has two strings) then I just need to use the list of column
names to supply it to 2nd function that'll query the DB for those
columns.]
--
To post to this group, send email to
javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
--
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en