迭代器iterator遍歷map 用迭代器iterator遍歷list中第一條數(shù)據(jù)和最后一條數(shù)據(jù),并判斷?
用迭代器iterator遍歷list中第一條數(shù)據(jù)和最后一條數(shù)據(jù),并判斷?迭代器迭代器=列表迭代器()Object first=null Object last=null int count=0,而(迭
用迭代器iterator遍歷list中第一條數(shù)據(jù)和最后一條數(shù)據(jù),并判斷?
迭代器迭代器=列表迭代器()Object first=null Object last=null int count=0,而(迭代器.hasNext()){count Object temp=迭代器.next()if(count==1){first=temp}else{if(!迭代器.hasNext()){//最后一個元素last=temp}}}后跟first和last。但你沒有具體說明要處理什么,所以寫起來不容易