【备注】Java链表

ArrayList vs LinkedList in Java.jpg
ArrayList LinkedList and CopyOnWriteArrayList.jpg
linkedlist.png
        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

以下是同一信息的中文摘要选项:

1. http://www.java67.com/2015/06/20-java-arraylist-interview-questions.html
2. http://javarevisited.blogspot.jp/2011/11/collection-interview-questions-answers.html
3. http://www.javatpoint.com/data-structure-interview-questions

广告
将在 10 秒后关闭
bannerAds