Java ?????LinkedList??????
???????????? ???????[ 2015/1/15 10:51:25 ] ????????Java LinkedList
????1.????
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Java API???????????Java???---LinkedList???LinkedList??????????????????????????????linkedList?в??????????????????????????????????????????????????????????????????????????У??????????????????????????????????????ú???洢????????????????????????????????????????????ü?????????????????????????????????????????????????????????κ?λ??????????????LinkedList???????get()???????????????????????????????λ????????????LinkedList?????????addFrist()??addLast()??getFrist()??getLast()??removeFirst()??removeLast()????????Щ???????LinkedList???????????????У????????????á???????LinkedList??????????
package com.test.collections;
import java.util.LinkedList;
public class LinkedListTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
LinkedList<String> linkedList = new LinkedList<String>();
linkedList.add("A");
linkedList.add("B");
linkedList.add("C");
linkedList.add("D");
linkedList.add("E");
linkedList.add("F");
linkedList.addFirst("G");
linkedList.addLast("H");
System.out.println(linkedList.element());
System.out.println(linkedList.contains("A"));
System.out.println(linkedList.element());
System.out.println(linkedList.get(4));
System.out.println(linkedList.getFirst());
System.out.println(linkedList.getLast());
System.out.println(linkedList.indexOf("C"));
System.out.println(linkedList.contains("D"));
System.out.println(linkedList.offer("F"));
System.out.println(linkedList.isEmpty());
System.out.println(linkedList.iterator().next());
linkedList.push("N") ;
}
}
|
????2.??н?
????LinkedList?????AbstractSequentialList???????List<E>?? Deque<E>?? Cloneable?? Serializable????????????????transient?????????size??Node<E>?????first??last;first ???????????????last???????????????????????????????ListedList???????????????ListIterator????ListItr?????????????Node???????Iterator<E????DescendingIterator?????????μ???????????????????Node????????????顣
????private static class Node<E> {
????E item;
????Node<E> next;
????Node<E> prev;
????Node(Node<E> prev?? E element?? Node<E> next) {
????this.item = element;
????this.next = next;
????this.prev = prev;
????}
????}
????Node?????item???????????????next?????????????????prev?????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11