I need to load file data in arraylist which I have done by creating a method. How can I count number of students using streams by creating a separate method for counting names. I have a student class with constructor, getters and setters.
I have a file having data as
Subjects : eng, phy, chem
Subjects : math, bio
//name is variable in student class // getName is the getter
You seem to be confusing things, and your naming doesn't help. Who calls a Map n or a predicate getName? What's more, the getName title suggest you don't know what you want the predicate to do. We can't help if all you tell us is, “doesn't work”. What is the point of .filter(...) being followed by .groupingBy(...) using a name?
Let's move you to the correct forum, and let you give us more explanation.