大家好,我正在尝试将一个jsoup元素与所有其他元素进行比较,如果两个元素相等,则需要创建count++;在这种情况下,我需要将links1中的所有元素与links2 links3 links4中的所有元素进行比较。
Document document1 = Jsoup.parse(webPage1);
Elements links1 = document1.select("example");
Document document2 = Jsoup.parse(webPage2);
Elements links2 = document2.select("example");
Document document3 = Jsoup.parse(webPage3);
Elements links3 = document3.select("example");
Document document4 = Jsoup.parse(webPage4);
Elements links4 = document4.select("example");什么是code....in JSP....
发布于 2012-03-24 06:25:55
Elements只是一个Element列表,因此compating将如下所示:
for (Element element : links1) {
if(links2.contains(element)){
count++;
}
//maybe do the same thing with links3 links4.
}如果你想在JSP中实现,那就是另一个问题了。
https://stackoverflow.com/questions/9845819
复制相似问题