Connection con = Jsoup.connect(https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8); //Just giving an example
Document htmlDoc = con.get();
Elements linksOnPage = htmlDoc.select("a[href]");
for(Element link : linksOnPage){
//pushing the links on to a stack
}
What I need is that I want to push the links retrieved in such a way that the first link retrieved from linksOnPage becomes my stack top.
1) Can someone suggest me if there is any other way to traverse the link object backwards?
2) Any other way? like for example what if I copy all those links in their order of arrival to a LinkedList and then traverse the list backwards? I understand that this could be a little naive method.