LinkedList interface (there is no difference between the use of code and ArrayList)
The ArrayList is an object array, so ArrayList has the advantage of fast query speed and the disadvantage of slow deletion.
At the bottom of the LinkedList is a two-way loop linked list. Each data node on this list is made up of three parts: the front pointer (pointing to the position of the previous node), the data, and the back pointer (pointing to the position of the following node). The last node's back pointer points to the front pointer of the first node, forming a loop.
The query efficiency of two-way circular linked list is low but the efficiency is high. Therefore, the LinkedList has the characteristics of low query efficiency but high efficiency and deletion.
There is no difference in usage between ArrayList and LinkedList, but there are differences in function.
LinkedList are often used in situations where there are more or less operations and few query operations: queues and stacks.
Queue: FIFO data structure.
Stack: A last-in, first-out data structure.
1 Packagetomtexts;2 3 classsuperclass{4 voidSuperPrint () {5System.out.println ("This is superclass!");6 }7 }8 classSubclassextendssuperclass{9 Ten voidSuperPrint () { OneSystem.out.println ("This is subclass!"); A } - } - Public classtomtexts_10{ the Public Static voidMain (String args[]) { -Subclass Subobject =Newsubclass (); -Subobject.superprint ();//methods for subclass objects to call subclasses -Superclass Superobject =Newsuperclass (); +Superobject.superprint ();//Parent Class Object Calling method of parent class - } +}
ArrayList has the advantage of the fast query speed of the array and the disadvantage of the slow and delete speed