import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
public class CollectionDemo {
// public static class PK_person{
// private String prefix;
// private long number;
// public String getPrefix() {
// return prefix;
// }
// public void setPrefix(String prefix) {
// this.prefix = prefix;
// }
// public long getNumber() {
// return number;
// }
// public void setNumber(long number) {
// this.number = number;
// }
//
// public String getPk() {
// return this.prefix+"_"+this.number;
// }
//
// public void setPk(String pk) {
// int i=pk.indexOf("_");
// this.prefix=pk.substring(0,i);
// this.number=new Integer(pk.substring(i));
// }
//
// public int hashCode()
// {
// return (int) (number+prefix.hashCode());
// }
//
// public boolean equals(Object obj)
// {
// if(obj==null)
// return false;
// if(getClass()!=obj.getClass())
// return false;
// if(this==obj)
// return true;
// final PK_person other=(PK_person)obj;
// if(this.hashCode()!=other.hashCode())
// return false;
// return true;
// }
//
//
// }
// public static class Person{
// private String name;
// private PK_person number;
// public Person(PK_person number,String name)
// {
// this.number=number;
// this.name=name;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public PK_person getNumber() {
// return number;
// }
// public void setNumber(PK_person number) {
// this.number = number;
// }
// }
public static void main(String[] args) {
// Person person1=new Person("Ma",220181);
// Person person2=new Person("Li",220193);
// Person person3=new Person("Wang",220186);
// Map<Number,Person> map=new HashMap<Number,Person>();
// map.put(person1.id_card, person1);
// map.put(person2.id_card,person2);
// map.put(person3.id_card, person3);
//
// System.out.println("under hashmap no order");
// for(Iterator<Number> it=map.keySet().iterator();it.hasNext();)
// {
// Person person=map.get(it.next());
// System.out.println(person.getId_card()+" "+person.getName());
// }
//
// System.out.println("under TreeMap key asc");
// TreeMap<Number,Person> treeMap=new TreeMap<Number,Person>();//Create new TreeMap and copy map to TreeMap
// treeMap.putAll(map);
// for(Iterator<Number> it=treeMap.keySet().iterator();it.hasNext();)
// {
// Person person=treeMap.get(it.next());
// System.out.println(person.getId_card()+" "+person.getName());
// }
//
// System.out.println("under TreeMap key desc");
// TreeMap<Number,Person> treeMap2=new TreeMap<Number,Person>(Collections.reverseOrder());
// treeMap2.putAll(map);
// for(Iterator<Number> it= treeMap2.keySet().iterator();it.hasNext();)
// {
// Person person=treeMap2.get(it.next());
// System.out.println(person.getId_card()+" "+person.getName());
// }
// Map<PK_person,Person> map=new HashMap<PK_person,Person>();
// PK_person pk_person=new PK_person();
// pk_person.setPrefix("MR");
// pk_person.setNumber(220181);
// map.put(pk_person, new Person(pk_person,"ma"));
// PK_person pk_person2=new PK_person();
// pk_person2.setPrefix("MR");
// pk_person2.setNumber(220181);
// Person person2=map.get(pk_person2);
// if(person2==null)
// System.out.println("no object available");
// else
// System.out.println(person2.getNumber().getNumber()+" "+person2.getName());
// Map<Integer,String> map=new HashMap<Integer,String>();
// map.put(001, "first student");
// map.put(002, null);
// System.out.println(map.get(001));
// System.out.println(map.get(002));
// System.out.println(map.get(003));
//
// System.out.println(map.containsKey(001));
// System.out.println(map.containsKey(002));
// System.out.println(map.containsKey(003));
// Map<Integer,String> map=new HashMap<Integer,String>();
// map.put(220180, null);
// map.put(220181, "Ma");
// System.out.println("get return result");
// System.out.println(map.get(220180));
// System.out.println(map.get(220181));
// System.out.println(map.get(220182));
//
// System.out.println("Contains return result");
// System.out.println(map.containsKey(220180));
// System.out.println(map.containsKey(220181));
// System.out.println(map.containsKey(220182));
// Person person1=new Person("ma",220181);
// Person person2=new Person("Li",220186);
// Person person3=new Person("Wang",220183);
//
// TreeSet<Person> treeset=new TreeSet<Person>();
// treeset.add(person1);
// treeset.add(person2);
// treeset.add(person3);
//
// System.out.println("Before order");
// TreeSet<Person> treeset2=new TreeSet<Person>(treeset);
// Iterator<Person> it=treeset2.iterator();
// while(it.hasNext())
// {
// Person p=it.next();
// System.out.println("--"+p.name+" "+p.id_card);
// }
// Person person1=new Person("ma",220181);
// Person person2=new Person("li",220186);
// Person person3=new Person("wang",220183);
// Person person4=new Person("yi",220186);
// Person person5=new Person("wang2",220175);
// TreeSet<Person> treeset=new TreeSet<Person>();
// treeset.add(person1);
// treeset.add(person2);
// treeset.add(person3);
// treeset.add(person4);
// treeset.add(person5);
//
// System.out.println("initial treeset");
// Iterator<Person> it=treeset.iterator();
// while(it.hasNext())
// {
// Person person=it.next();
// System.out.println("--"+person.getId_card()+" "+person.getName());
// }
// System.out.println("ahead part");
// it=treeset.headSet(person1).iterator();
// while(it.hasNext())
// {
// Person person=it.next();
// System.out.println("--"+person.getId_card()+" "+person.getName());
// }
// System.out.println("middle part");
// it=treeset.subSet(person1, person4).iterator();
// while(it.hasNext())
// {
// Person person=it.next();
// System.out.println("--"+person.getId_card()+" "+person.getName());
// }
//
// System.out.println("tail part");
// it=treeset.tailSet(person3).iterator();
// while(it.hasNext())
// {
// Person person=it.next();
// System.out.println("--"+person.getId_card()+" "+person.getName());
// }
//
// Set<Person> hashSet=new HashSet<Person>();
// hashSet.add(new Person("ma",220181));
// hashSet.add(new Person("li",220186));
// hashSet.add(new Person("wang",220193));
// Iterator<Person> it=hashSet.iterator();
// while(it.hasNext())
// {
// Person person=it.next();
// System.out.println(person.getName()+" "+ person.getId_card());
// }
// List<Person> list=new ArrayList<Person>();
// String names[]= {"feng", "wang", "li"};
// long id_cards[]= {220181, 220193, 220186};
// for(int i=0;i<names.length;i++)
// {
// Person person=new Person();
// person.setName(names[i]);
// person.setId_card(id_cards[i]);
// list.add(person);
// }
//
// System.out.println("Before sort");
// for(int i=0;i<list.size();i++)
// {
// Person person=list.get(i);
// System.out.println("---"+person.getName()+" "+person.getId_card());
//
// }
// PersonComparator personComparator=new PersonComparator();
// System.out.println("order by name");
// Collections.sort(list,personComparator);
// for(int i=0;i<list.size();i++)
// {
// Person person=list.get(i);
// System.out.println("---"+person.getName()+" "+person.getId_card());
// }
//
// personComparator.orderB
没有合适的资源?快使用搜索试试~ 我知道了~
workspace_java_sourcecode_20101206
共2308个文件
class:965个
java:703个
gif:145个
需积分: 3 6 下载量 40 浏览量
2011-01-23
21:50:16
上传
评论
收藏 9.07MB RAR 举报
温馨提示
workspace_Me_20101206_java_soucecode
资源推荐
资源详情
资源评论
收起资源包目录
workspace_java_sourcecode_20101206 (2308个子文件)
NotepadGUI.class 11KB
UserAccess.class 10KB
UserViewProduct.class 10KB
SystemMainWindow.class 8KB
BookManager.class 8KB
Tank.class 8KB
AdminMainWindow.class 8KB
ModifyProduct.class 7KB
StoreModifyProduct.class 7KB
BookReturn.class 7KB
StoreAddProduct.class 7KB
UserViewProductDetail.class 7KB
QQManager.class 6KB
AddProduct.class 6KB
StoreAdmin.class 6KB
UserRegister.class 6KB
RuntimeGUI.class 6KB
ModifyUser.class 6KB
UserModifyInfo.class 6KB
ClassTreeFrame.class 6KB
BankAccess.class 6KB
StoreUserRegister.class 6KB
BookBorrow.class 6KB
LoginRegisterAction.class 6KB
ModifyExpress.class 6KB
PaintDemo.class 6KB
StoreUserLogin.class 6KB
Draw.class 6KB
StoreProductManager.class 6KB
ModifyStore.class 6KB
ModifyOrderForm.class 6KB
StoreModifyInfo.class 6KB
UserLogin.class 6KB
AdminUserLogin.class 6KB
BankClass.class 5KB
ManagerOrderForm.class 5KB
ManagerProduct.class 5KB
ManagerExpress.class 5KB
StoreAddExpress.class 5KB
ManagerCategory.class 5KB
MineGameDemo.class 5KB
ManagerStore.class 5KB
TankClient.class 5KB
Explorer.class 5KB
ManagerUser.class 5KB
AddUser.class 5KB
LibraryTest.class 5KB
StoreViewOrderDetail.class 5KB
CopyGUI.class 5KB
ClassroomDAO.class 5KB
ComputerDAO.class 5KB
SoftwareDAO.class 5KB
ViewTopicAction.class 5KB
UploadAction.class 5KB
BookAccess.class 5KB
RequestTest.class 5KB
Library.class 5KB
DeskDAO.class 5KB
UserAccess.class 5KB
FileExplorerGUIError.class 5KB
AddOrderForm.class 5KB
AddStore.class 5KB
Calculator.class 5KB
Missile.class 5KB
Game.class 4KB
XMLTest.class 4KB
ModifyCategory.class 4KB
Explorer.class 4KB
ListTopicAction.class 4KB
AddExpress.class 4KB
InterruptibleSocketFrame.class 4KB
PostTestFrame.class 4KB
QQUserManager.class 4KB
RegisterAction.class 4KB
MenuFrame.class 4KB
LoginAction.class 4KB
ShowEmployeeName.class 4KB
ReflectionTest.class 4KB
StoreViewOrder.class 4KB
BookList.class 4KB
UserViewExpress.class 4KB
AddPicDemo.class 4KB
StoreViewExpress.class 4KB
Client.class 4KB
TableSelectionFrame.class 4KB
AddCategory.class 4KB
MyEclipseGen.class 4KB
Student.class 4KB
BankChina.class 4KB
TestForm.class 4KB
CalcDemo.class 3KB
NIOTest.class 3KB
UserAccess.class 3KB
PaintDemo.class 3KB
UploadAction.class 3KB
HelpAboutWindow.class 3KB
Pane.class 3KB
SliderTestFrame.class 3KB
BookBorrowDemo.class 3KB
Search.class 3KB
共 2308 条
- 1
- 2
- 3
- 4
- 5
- 6
- 24
资源评论
fellowlei
- 粉丝: 1
- 资源: 67
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- zebra打印机中文配置
- low_side_current_sense_circuit_design_an-c.pdf
- 新工程.pdsprj
- 上海大学大学生创新创业训练计划申请书(创新训练项目).doc
- matplotlib-3.8.4-cp39-cp39-macosx-10-12-x86-64.whl
- Spire.Presentation for Java 9.2.8 全功能无限制资源
- 基于51单片机和APP的电子广告牌设计.docx
- PDF Gallery_20240506_145613.pdf
- 2006高教社杯全国大学生数学建模竞赛A、B题评阅要点.doc
- fonttools-4.51.0-cp39-cp39-macosx-10-9-x86-64.whl
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功