Java stream find specific element

Subject interestedSubject = subjects.stream()
  .filter(subject -> "Java".equals(subject.getName()))
  .findAny()
  .orElse(null);
Content Protection by DMCA.com
Please Share