根据给定条件从java中的数组排列子列表

时间:2018-12-06 10:17:09

标签: java arrays sorting

我有4个数组,想要排列子列表:

String[] subject_code = {"160","160","161","161","161","162","162","164","164","164","163","163"};

String[] external_marks = {"DNR","50","DNR","SA","60","DNR","55","DNR","52","22","DNR","65"};

String[] result = 
{"--","Pass","--","---","Pass","--","Pass","--","Pass","Fail","--","Pass"};

String[] date_of_exam = {"--","2018-06-28","--","---","2018-06-28","--","2018-06-28","--","2018-12-15","2018-06-28","--","2018-06-28"};

条件: 在external_marks []数组中,SA应该排在第一位,然后是DNR,最后是按尝试日期在该subject_code子列表(根据条件排列子列表)上按升序排列的标记

示例- 看看161个主题代码的子列表应该是这样的:

161","161","161
"SA","DNR","60"
"---","--","P"
"---","--","2018-06-28"

最终名单如下:

String[] subject_code = {"160","160","161","161","161","162","162","164","164","164","163","163"};

String[] external_marks = {"DNR","50","SA","DNR","60","DNR","55","DNR","22","52","DNR","65"};

String[] result = {"--","Pass","---","--","Pass","--","Pass","--","Fail","Pass","--","Pass"};

String[] date_of_exam = {"--","2018-06-28","---","--","2018-06-28","--","2018-06-28","--","2018-06-28","2018-12-15","--","2018-06-28"};

请帮助我根据上述条件对数组子列表进行排序

0 个答案:

没有答案