For e.g. I have a List A that has object of class B in it and then class B has a property called as name (String) in it.
Is there any way that I can directly extract the property name to a new List<String> from List A
List<B> A = new ArrayList<>({B1, B2, B3});
now B1 has name = "John"
B2 has name = "Michael"
B3 has name = "Doe"
Now directly from List A without myself using a for loop can I create a list with all John, Michael and Doe in it.