0

I have an array of objects TimeTrial. Each TimeTrial object contains the time to run the trial, the distance, and the person who ran it.

Given a person, I want to see whether the person has run any of the trials in the list. If the list was just a list of people, I would write trials.contains(person).

In Python, I would just do if person in map(lambda trial: trial["runner"], trials). But this functionality doesn't seem too be available in Java.

Is there a simple way to do this without writing a For loop?

Andrew Latham
  • 5,982
  • 14
  • 47
  • 87

0 Answers0