java - Sorting List in pairs without using Map or Sets -
i have strange problem in have data in 3 columns of students follows,
student initdate findate abc 2/2/2016 5/5/2017 abc 3/2/2016 3/30/2017 ced 1/1/2015 3/12/2017 lef 1/12/2016 11/17/2017 ced 1/12/1999 12/23/207 lef 2/13/2000 11/19/2017
my goal find lowest initdate
of every student , highest findate
of same student. data stored string have parse dates have done using dateformat
parse date first.
initially, tried storing data in pair student
,initdate
, other pair student
,findate
, , tried storing data in hashmap
date key problem store unique data , if 2 students have same initial dates 1 of them stored in hashmap.
i realized cannot use set
, maps
store data store unique values have decided use list
.
i have created 3 lists, 1 of type string
, other 2 of type date
, can store duplicate data. have stored student names in 1 list , dates in other 2 lists.
what want sort list of students in such way initdate
, findate
sorted according student.
is there anyway sort 1 list based on other list in case of hashmaps ?
have considered writing own student class properties need , storing them list of student objects? can iterate through list of student objects find lowest value of init date , iterate through once more find highest fin date student id equal student id of first student object you've found.