public class City
{
String name;
int id;
static int idCounter = 0;
public City(String name)
{
this.name=name;
id = idCounter++;
}
}
import java.util.ArrayList;
public class Gr...
分类:
编程语言 时间:
2014-06-19 10:36:26
阅读次数:
196
集合类是一种将各相同类型的对象集合起来的类,数组实质上也是集合类型中的一种。
集合主要是以线性结构存储结构
C#提供ArrayList类、Queue类、Stack类
1.ArrayList类简介:
ArrayList类可以动态地添加和删除元素。
ArrayList类相当于一种高级的动态数组,是Array类的升级版本,但它并不等同于数组。
2.与数...
分类:
其他好文 时间:
2014-06-19 09:55:19
阅读次数:
229
ArrayList,LinkedList,Vestor这三个类都实现了java.util.List接口,但它们有各自不同的特性,主要如下:
ArrayList:底层用数组实现的List 特点:查询效率高,增删效率低 轻量级 线程不安全 LinkedList:底层用双向循环链表实现的List
特点:查...
分类:
其他好文 时间:
2014-06-16 10:07:45
阅读次数:
291
package 单例模式; import java.awt.List;import
java.util.ArrayList;import java.util.Arrays; public class Country implements
Comparable{ int jin; int yin; i...
分类:
其他好文 时间:
2014-06-13 15:38:12
阅读次数:
183
1 (一)ArrayList类:表示大小可按需动态增加的数组 2 protected void
Page_Load(object sender, EventArgs e) 3 { 4 ArrayList al = new ArrayList(); 5
al.Add(100...
分类:
Web程序 时间:
2014-06-12 18:37:24
阅读次数:
255
package com.teffy.viewpager;import
java.util.ArrayList;import java.util.concurrent.Executors;import
java.util.concurrent.ScheduledExecutorService;impo...
分类:
其他好文 时间:
2014-06-12 11:23:05
阅读次数:
390
类层次关系如下:Collection├List│├LinkedList│├ArrayList│└Vector│ └Stack└SetMap├Hashtable├HashMap└WeakHashMap下面来分别介绍Collection接口
Collection是最基本的集合接口,一个Collecti....
分类:
编程语言 时间:
2014-06-12 10:01:52
阅读次数:
290