Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaʵÏÖ½«Mapת»»ÎªListµÄС´úÂë

import java.util.ArrayList; 
import java.util.HashMap; 
import java.util.Iterator; 
import java.util.List; 
import java.util.Map; 
public class ConvertMapToList {
    /**
     * ʵÏÖ½«HashMapת»»³ÉΪArrayList£¬²¢½«mapµÄKey ¡¢Value·Ö±ð´æ·Åµ½Á½¸öArrayListµ±ÖÐ
     * @param args
     */
    public static void main(String[] args) {
        Map map = new HashMap();
        map.put("a", "a1");
        map.put("b", "b1");
        map.put("c", "c1");
        List listKey = new ArrayList();
        List listValue = new ArrayList();
        Iterator it = map.keySet().iterator();
        while (it.hasNext()) {
            String key = it.next().toString();
            listKey.add(key);
            listValue.add(map.get(key));
        }
        System.out.println("Convert Finished !");
        
        //output the context of the ArrayList
        for(int i =0 ;i<listKey.size();i++){
            System.out.print("Key :"+listKey.get(i));
            System.out.println("     Value :"+listValue.get(i));
        }
    }
}


Ïà¹ØÎĵµ£º

java×Ö·û´®×ª»»³ÉÈÕÆÚ

package com.gaosheng.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class StringToDate {

/**
* ×Ö·û´®×ª»»³ÉÈÕÆÚ
* @param stringdate Ҫת»»µÄ×Ö·û´®(×Ö·û´®¸ñʽ yyyy-MM-dd)
* @return
*/
public Date getStringtoDate(Strin ......

JavaÖеÄ23ÖÖÉè¼ÆÄ£Ê½

  1¡¢¹¤³§Ä£Ê½£º¿Í»§ÀàºÍ¹¤³§Àà·Ö¿ª¡£Ïû·ÑÕßÈκÎʱºòÐèҪijÖÖ²úÆ·£¬Ö»ÐèÏò¹¤³§ÇëÇó¼´¿É¡£Ïû·ÑÕßÎÞÐëÐ޸ľͿÉÒÔ½ÓÄÉвúÆ·¡£È±µãÊǵ±²úÆ·ÐÞ¸Äʱ£¬¹¤³§ÀàÒ²Òª×öÏàÓ¦µÄÐ޸ġ£È磺ÈçºÎ´´½¨¼°ÈçºÎÏò¿Í»§¶ËÌṩ¡£  
¡¡¡¡2¡¢½¨Ôìģʽ£º½«²úÆ·µÄÄÚ²¿±íÏóºÍ²úÆ·µÄÉú³É¹ý³Ì·Ö¸î¿ªÀ´£¬´Ó¶øÊ¹Ò»¸ö½¨Ôì¹ý³ÌÉú³É¾ßÓв»Í¬µ ......

javaÊý¾Ý¿âÉè¼ÆÖеÄ14¸ö¼¼ÇÉ

ÏÂÊöÊ®Ëĸö¼¼ÇÉ£¬ÊÇÐí¶àÈËÔÚ´óÁ¿µÄÊý¾Ý¿â·ÖÎöÓëÉè¼ÆÊµ¼ùÖУ¬Öð²½×ܽá³öÀ´µÄ¡£¶ÔÓÚÕâЩ¾­ÑéµÄÔËÓ㬶ÁÕß²»ÄÜÉú°ïÓ²Ì×£¬ËÀ¼ÇÓ²±³£¬¶øÒªÏû»¯Àí½â£¬ÊµÊÂÇóÊÇ£¬Áé»îÕÆÎÕ¡£²¢Öð²½×öµ½£ºÔÚÓ¦ÓÃÖз¢Õ¹£¬ÔÚ·¢Õ¹ÖÐÓ¦Óá£
      1. ԭʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹ØÏµ
¡¡¡¡
      ¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à ......

javaÖÐmap¼¯ºÏµÄÓ÷¨

1.ÉùÃ÷Ò»¸ömap: Map map = new HashMap();
2.ÏòmapÖзÅÖµ,×¢Ò⣺mapÊÇkey-valueµÄÐÎʽ´æ·ÅµÄ.Èç:
     map.put("sa","dd");
3.´ÓmapÖÐȡֵ:String str = map.get("sa").toString();½á¹ûÊÇ:str = "dd";
4.±éÀúÒ»¸ömap£¬´ÓÖÐÈ¡µÃkey ºÍvalue
JDK1.5
Map m = new HashMap();
for ( ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ