有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

安卓如何在java中按给定的天数排列数据以数组形式显示?

String[] daysList = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};

现在给定的输入字符串是

String getRoutePlanDay = "Thu";

所以输出应该是

output: "Thu", "Fri","Sat","Mon" ,"Tue","Wed".

类似地,例如:如果给定的字符串是

String getRoutePlanDay = "Fri";

 Expected output: "Fri","Sat","Mon" ,"Tue","Wed","Thu"

因此,如何通过给定输入字符串的开头对数组列表进行排序

 List<String> asSet = new ArrayList<String>(Arrays.asList(daysList));
  //but i couldn't figure out how to use the getRoutePlanDay by comparing with the list and arranging it and storing in string array? 

共 (0) 个答案