Thanks... Yes, this way I know but is it advisable to use this, when you need to do this job mutiple no of times when you're generating a single page on a website for a single user ? Aren't there any libraries that accomplish this in a much better way.
I guess I require something that is superfast & reasonably efficient as well. My use case is a website and this job needs to be done multiple no of times and for several pages, on the website. On Sun, Feb 20, 2011 at 2:13 AM, <gaiji...@gmail.com> wrote: > It would be best if you can code the 2nd function yourself. That way you can > receive what 1st function returns. > > Internally you could use: > > void foo(List<Column<String, String> list) { > for(Column<String, String> column : list) { > String columnName = column.getName(); // I assume there is a getter for this > field > // more code > } > } > > If that is not an option, then you can do exactly the same but in the "more > code" part, add the String to a List and after the loop, return it. > > The first option is better because you accomplish you goal in time > proportional to the size of the list, while in the second it is proportional > to the square of the size. If you have a lot of entries that may be > significant. > > Enviado desde BlackBerry® de COMCEL S.A. > > ________________________________ > From: Raj <rajkumar....@gmail.com> > Sender: java-ee-j2ee-programming-with-passion@googlegroups.com > Date: Sat, 19 Feb 2011 04:02:05 -0800 (PST) > To: <java-ee-j2ee-programming-with-passion@googlegroups.com> > ReplyTo: rajkumar....@gmail.com > Subject: [java ee programming] Java Collections List : Converting from List > '<Column <String1, String2>>' to 'List <String1>' > > 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.] > > -- > You received this message because you are subscribed to the Google > Groups "Java EE (J2EE) Programming with Passion!" group. > To post to this group, send email to > java-ee-j2ee-programming-with-passion@googlegroups.com > To unsubscribe from this group, send email to > java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en