// this this the orginal code:
public void searchBird (int indexPosition) {
    Bird bird = birdList.get(indexPosition);
    System.out.println ("Art:" + bird.getArt ());
    System.out.println ("Location:" + bird.getLocation ());
}
I have so far tried to code a method which returns one element out of the ArrayList with a given index as a parameter. I get an error message when I send in, for example 5, as a parameter.
// and this is what i tried:
public void searchBird (int indexPosition) {
    Bird bird = birdList.get(indexPosition);
    for (int i = 0; i <bird list.size (); i ++) {
        if ((birdList.contains(indexPosition))) {
            System.out.println ("Art:" + bird.getArt ());
            System.out.println ("Location:" + bird.getLocation ());
        }
    }
}
this is what i get;
java.lang.IndexOutOfBoundsException: Index: 5, Size: 3 when calling the method with 5 as a parameter
 
    