I have a set of objects that are the same type of object. Inside this type there is an attribute that I want to refer to - in this case, it should add it to the comma-separated list:
String sep = ", ";
List<Item> items = db.findItems();
for (Item item : items)
{
result.append(item.getDescription() + sep);
}
return result.substring(0, results.length - sep.length());
It would be nice if I could just access this attribute from all the objects in the collections so that I can call the Guava joiner function of Guava:
return Joiner.on(", ").join();
The type of structure that I think of is similar to a 2D array, where each column represents an attribute, and each row represents an object, and therefore I want to be able to call either a specific row that returns an object or a specific column (attribute) that returns a collection of attributes from all objects.
Java , ?
,
.