package com.lideng.work322; /** * 自己实现map集合 * @author Administrator * */ public class Dome3 { Entry[] arr =new Entry[990]; int size; public void put(Object key,Object value){ Entry en=new Entry(key, value); arr[size++]=en; } public static void main(String[] args) { Entry en=new Entry("001",12); System.out.println(en.value); } public Object get(Object key){ for (int i = 0; i < size; i++) { if(arr[i].key.equals(key)){ return arr[i].value; }; } return null; } } class Entry{ Object key; Object value; public Entry(Object key,Object value){ this.key=key; this.value=value; } }