I have a class A and its members b and c.
Now I construct the List<A>
with this:
add(new A().setb("abcd").setc("123456"));
add(new A().setb("efgh").setc("789101"));
add(new A().setb("ijkl").setc("112345"));
I want to transform this List to string which looks like this
abcd,123456
efgh,789101
ijkl,112345
Now the very obvious way would be to have a StringBuilder
and iterate across the List. Now I want to establish this using Guava Joiner
like
Joiner.on("\n").skipNulls().join(.......)
the join()
method expects an iterable. Can I somehow pass A.getb(),A.getc()
Will Iterables.transform
help?
Solved it!!
Lets say the
List<A>
is calledAlist