//方法一 先保存符合條件的值然後遍歷刪除
List<String> obeyList = new ArrayList<String>();
for (String temp : list)
{
if (temp.compareTo(currentDate) < 0)
{
obeyList.add(temp);
}
}
for (String deleteLine : obeyList)
{
list.remove(deleteLine);
}
//方法二使用迭代法
Iterator<String> it = list.iterator();
while (it.hasNext()) {
String temp = it.next();
if (temp.compareTo(currentDate) < 0) {
it.remove();
}
}