java LinkedList类详解
LinkedList的特有功能
A:添加功能
1
2
3
|
public void addFirst(Object e); public void addLast(Object e); |
B:特有功能
1
2
|
public Object getFirst(); public Object getLast(); |
C:删除功能
1
2
3
4
5
|
public Object removeFirst(); public Object removeLast(); |
实例代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
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); } } |
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!