I have one list where it may has maximum 2 values OR minimum 0 values. Now I need to set the first item value and second item value to my pojo class.

```
List<student> studentList  = studentRepository.findById(idval);

studentList.forEach(student -> {

            st.setStartTime(student.getStartTime()); // fetch from 1st item
            st.setEndTime(student.getEndTime()); // fetch from 1st item
            st.setNextStartTime(student.getStartTime()); // fetch from 2nd item
});

```

Here I need to set values to my `studentList` pojo. In that pojo I need to set 3 attributes where first two attribute values are from the 1st item of the list and the third attribute value is from the 2nd item of the list. 

Can anyone suggest some good way to do the same.

EDIT:
I have a list (studentList) which has two student class object items. (Lets assume the list has studentA and studentB information). Now I need to iterate the studentList and set the values to one pojo (st). In the `st` pojo I have 3 attributes are there. here I need to set the first two attribute values with studentA information and the third attribute value with studentB information.