I have a question.
Suppose I have a List<SomeClass> and there is an attribute named "SomeAttribute" in "SomeClass". Now is there any way to get all the "SomeAttribute" values from List<SomeClass> as an array using reflection, collection api or lambda expression?
If you don't require the field lookup to be dynamic, you can just use a method expression, like this:
I use Locale because it's easy to get a bunch of interesting objects. Turn into a stream, and then map the method expression. That gives a stream of the attribute values. The last line prints the all. Or you can collect them into a list.