【发布时间】:2014-05-24 10:04:12
【问题描述】:
我无法确定根据一个列表的排序顺序对多个列表进行排序的最佳方法。目前,这些列表是根据它们的索引排序的。离开时间列表包含格式为 (00:00 AM/PM) 的时间字符串。它们是这样初始化的:
public static List<String> departureTime = new ArrayList<String>();
public static List<String> mode = new ArrayList<String>();
public static List<String> busNo = new ArrayList<String>();
public static List<String> busStopName = new ArrayList<String>();
public static List<String> arrivalTime = new ArrayList<String>();
public static List<String> dur = new ArrayList<String>();
我需要根据离开时间数组列表中的出发时间排序顺序对所有列表进行排序。在不更改结果数据结构的情况下对这些列表进行排序的最佳方法是什么。任何帮助将不胜感激。
谢谢,
马特
【问题讨论】:
-
通过创建一个包含每个列表中的值的对象来解决这个问题会更容易。然后,您可以拥有一个对象列表并根据您关心的值进行排序。
标签: java android sorting arraylist