java Detailed explanation of LinkedList class
Unique functions of LinkedList
A: Add function
public void addFirst(Object e); public void addLast(Object e);
B :Special function
public Object getFirst(); public Object getLast();
C:Delete function
public Object removeFirst(); public Object removeLast();
Example code:
import java.util.LinkedList; /* * LinkedList的特有功能 * * A:添加功能 * public void addFirst(Object e); * public void addLast(Object e); * * B:特有功能 * public Object getFirst(); * public Object getLast(); * * C:删除功能 * public Object removeFirst(); * public Object removeLast(); * */ public class IntegerDemo { public static void main(String[] args) { // TODO Auto-generated method stub LinkedList link = new LinkedList(); link.add("hello"); link.add("world"); link.add("java"); link.addFirst("javaee"); link.addLast("android"); System.out.println("link:" + link); } }
Thank you for reading, I hope it can help everyone, thank you everyone for your support of this site!
Please pay attention to the PHP Chinese website for more detailed explanations and example code related articles on the Java LinkedList class!