- 论坛徽章:
- 0
|
import java.util.*;
public class JAVAContainer {
public static void main(String[] args) throws Exception{
//ArrayList
{
ArrayList arraylist=new ArrayList();
arraylist.add(0,"end");//指定索引加入值
//需注意的是,如果现有2个值,我加入索引为5的那么就会出现异常
for(int i=0;ijava JAVAContainer
ArrayList:
0;1;end;
ArrayList's lastIndexOf("0") is 4
Arrays:
a;b;c;
Arrays's length is 3
Collections:
Fill;Fill;Fill;
[1, 2, 3]
[1, 3, 2]
EventObject:
hello
false
HashMap:
{3=a, 2=b, 0=c, 1=a}
a;b;c;a;
HashSet:
[a, c, b]
a;c;b;
Hashtable:
c;b;a;c;
IdentityHashMap:
{3=b, 1=a, 0=c, 2=a}
true
true
[3=b, 1=a, 0=c, 2=a]
[3, 1, 0, 2]
LinkedHashMap:
{0=b, 2=a, 1=c, 3=b}
true
true
b;a;c;b;
LinkedHashSet:
[c, a, b]
true
c;a;b;
LinkedList:
[d, a, c, b]
d;a;c;b;
Stack:
c;b;d;e;a;
a
a
true;false
4
TreeMap:
{0=d, 1=b, 2=a, 3=c}
0
d;b;a;c;
TreeSet:
[a, b, c, d]
a
a;b;c;d;
Vector:
[b, a, d, c]
[b, a, h, c]
b;a;h;c;
[b, a]
WeakHashMap:
{3=a, 2=c, 0=d, 1=b}
true
true
3=a;2=c;0=d;1=b;
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/27594/showart_416742.html |
|