Here you can find the source of getFirstWithOwnText(final Elements elementList, final String text)
static Optional<Element> getFirstWithOwnText(final Elements elementList, final String text)
//package com.java2s; //License from project: Open Source License import java.util.Optional; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { static Optional<Element> getFirstWithOwnText(final Elements elementList, final String text) { return elementList.stream().filter(el -> el.ownText().equals(text)).findFirst(); }/* w w w .ja va2 s . c o m*/ }