java
LinkedList<String> list = new LinkedList<String>();
list.addLast("1");
list.addLast("2");
list.addLast("3");
list.addLast("4");
list.addLast("5");
Log.d("****", list.toString());
// [1, 2, 3, 4, 5]
list.removeFirst();
Log.d("****", list.toString());
// [2, 3, 4, 5]
list.removeFirst();
Log.d("****", list.toString());
// [3, 4, 5]
list.removeFirst();
Log.d("****", list.toString());
// [4, 5]
list.removeFirst();
Log.d("****", list.toString());
// [5]
list.removeFirst();
Log.d("****", list.toString());
// []
list.removeFirst();
Log.d("****", list.toString());
// NoSuchElementException
http://www.java67.com/2015/06/20-java-arraylist-interview-questions.html
http://javarevisited.blogspot.jp/2011/11/collection-interview-questions-answers.html
http://www.javatpoint.com/data-structure-interview-questions
Recommended Posts