Please help me. I can't get more then one value from my ArrayList
. Trying to parse some page, get all data. Put it inside ArrayList, but when I try to print it (by using get(0)), I can print only one value, when try get(1), program has crashed with
java.lang.IndexOutOfBoundsException: Index: 2, Size: 1
But I know that the Arraylist
is more then one value. Here is my code.
public class jaja {
final int[] score = {0};
public static void main (String[] args) throws IOException {
List<Integer> quesList = new ArrayList<>();
List<String> f1 = new ArrayList<>();
Document doc = Jsoup.connect("http://somepage.com/index/").get();
org.jsoup.select.Elements superelements = doc.getElementsByTag("tr");
for(Element Element : superelements) {
String Test = Element.getElementsByTag("td").get(0).text();
String Result = Element.getElementsByTag("td").get(1).text();
String fd = Element.getElementsByTag("td").get(1).text();
f1.add(fd);
Collections.shuffle(f1);
System.out.println("(" + "\"" + Test + "\"" + "," + "\"" + f1+ "\"" + "," + "\"" + f1.get(0) + "\"" + "," + "\"" + f1.get(f1.size() - 1) + "\"" + "," + "\"" + f1.get(f1.size() - 1) + "\"" + "," + "\"" + f1.get(f1.size() - 1) + "\"" + "," + "\"" + f1.get(f1.size() - 1) + "\"" + ");");
}
}
}