private ArrayList <QuizCard> cardList;
cardList = new ArrayList <QuizCard> ();
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
Iterator cardIterator = cardList.iterator();
while (cardIterator.hasNext()) {
QuizCard card = (QuizCard) cardIterator.next();
writer.write(card.getQuestion() + "/");
writer.write(card.getAnswer() + "\n");
}
writer.close();
} catch(IOException ex) {
System.out.println("couldn't write the cardList out");
ex.printStackTrace();
}
1) Iterator에 대한 자세한 설명
http://cafe.naver.com/javasp/2099
2) Iterator에 대한 추가 설명
http://cafe.naver.com/czsaylon/6113
http://cafe.naver.com/sgprogramingcenter/69
http://maydaisy.egloos.com/848313
http://alecture.blogspot.kr/2012/10/iterator-listiterator.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+blogspot/tgspg+(%EC%9E%90%EB%B0%94+%EA%B0%95%EC%A2%8C)
'개발 및 관리 > Java' 카테고리의 다른 글
파일 입출력, 읽고 쓰기 (0) | 2013.01.25 |
---|---|
File, java.io.file 클래스 (0) | 2013.01.25 |
FileWriter (0) | 2013.01.25 |
정적 변수(Static Variable)도 직렬화(Serializable) 되나요? (0) | 2013.01.25 |
Head First Java p.441 (0) | 2013.01.25 |