Newbie蔡  

2016年8月23日

摘要: 1 package 测试; 2 3 import java.util.Comparator; 4 5 public class ComparatorByLength implements Comparator { //定义比较器 6 7 @Override 8 public int compare(Object o1, Object o2) { 9 ... 阅读全文
posted @ 2016-08-23 22:10 Newbie蔡 阅读(2245) 评论(0) 推荐(0)
 
摘要: 1 public class Person implements Comparable{ 2 private String name; 3 private int age; 4 5 public Person(){ 6 super(); 7 } 8 public Person(String name, int ag... 阅读全文
posted @ 2016-08-23 21:48 Newbie蔡 阅读(275) 评论(0) 推荐(0)
 
摘要: 1 import java.util.ArrayList; 2 import java.util.Iterator; 3 4 import cn.itcast.p1.bean.Person; 5 6 public class ArrayListTest2 { 7 8 public static void main(String[] args) { 9 10 ... 阅读全文
posted @ 2016-08-23 16:39 Newbie蔡 阅读(439) 评论(0) 推荐(0)
 
摘要: 1 import java.util.ArrayList; 2 import java.util.Iterator; 3 4 import cn.itcast.p1.bean.Person; 5 6 public class ArrayListTest { 7 8 public static void main(String[] args) { 9 ... 阅读全文
posted @ 2016-08-23 16:13 Newbie蔡 阅读(809) 评论(2) 推荐(0)
 
摘要: 1 import java.util.LinkedList; 2 3 public class Test5 { 4 5 public static void main(String[] args) { 6 7 Duilie dl = new Duilie(); 8 9 dl.myAdd("abc1"... 阅读全文
posted @ 2016-08-23 15:48 Newbie蔡 阅读(869) 评论(0) 推荐(0)
 
摘要: 1 import java.util.Enumeration; 2 import java.util.Vector; 3 4 public class Test4 { 5 6 public static void main(String[] args) { 7 Vector v = new Vector(); 8 9 ... 阅读全文
posted @ 2016-08-23 14:30 Newbie蔡 阅读(355) 评论(0) 推荐(0)
 
摘要: 1 import java.util.ArrayList; 2 import java.util.Iterator; 3 import java.util.List; 4 5 public class Test3 { 6 7 public static void main(String[] args) { 8 List list = new Array... 阅读全文
posted @ 2016-08-23 13:47 Newbie蔡 阅读(577) 评论(0) 推荐(0)
 
摘要: 1 import java.util.ArrayList; 2 import java.util.Iterator; 3 import java.util.List; 4 5 public class Test2 { 6 7 public static void main(String[] args) { 8 List list = new Array... 阅读全文
posted @ 2016-08-23 12:41 Newbie蔡 阅读(935) 评论(0) 推荐(0)
 
摘要: 迭代 ●迭代是取出集合中元素的一种方式。 ●因为Collection中有iterator方法,所以每一个子类集合对象都具备迭代器。 ●用法: 第一种 第二种 迭代注意事项 ●迭代器在Collection接口中是通用的,它替代了Vector类中的Enumeration(枚举)。 ●迭代器的next方法 阅读全文
posted @ 2016-08-23 12:05 Newbie蔡 阅读(209) 评论(0) 推荐(0)