Imagine we are working with this class:

```
public Student{
  String name;
  Integer age;
  Integer height;
  Integer weight;
}

```

Now we've got a list of students and we are asked something like:

* filter those whose name is "Jonh" and get the average age
* filter those whose name is "Mary" and get the biggest hight
* filter those whose name is "Ben" and get the smallest weight

I think thar a clean and understandble solution is to use lambdas to filter by name and get what is asked for:

```
List<Student> students = ...
double jonhAge = students.stream().filter(s->s.getName().equals("Jonh").mapToInt(s->s.getAge()).average()
double maryHeight = students.stream().filter(s->s.getName().equals("Mary").mapToInt(s->s.getHeight()).max()
double benWeight = students.stream().filter(s->s.getName().equals("Ben").mapToInt(s->s.getWeight()).min()

```

I guess that at least it is iterating over the list 3 times, and using a single loop with conditions might be more efficent:

```
double jonhAge = 0;
double jonhCount = 0;
double maryHeight = 0;
double benWeight = 1000;
for(Student s : students){
  if(s.getName.equals("Jonh")){
    jonhAge += s.getAge();
    jonhCount++;
  }else if(s.getName.equals("Mary")){
    if(s.getHeight()>maryHeight)
      maryHeight = s.getHeight();
  }else if(s.getName.equals("Ben")){
    if(s.getWeight()<benWeight )
      benWeight = s.getWeight();
  }
}
jonhAge = jonhAge / jonhCount;

```

I think that the first way is cleaner but the second one is faster. Am I right? Which one shoud I use?
Imagine that the list of students contains a huge number of elements, and there are more names than Jonh, Mary and Ben.