close

 

   今天看到的物件:Enumeration

範例:

 

String rid = null;
String rcode = null;
String returnos = null;

 

Enumeration<String> keys = request.getParameterNames();

       while(keys.hasMoreElements()){
           String key = (String)keys.nextElement();
           String value = utils.initPara(request.getParameter(key), true);
           if(sbi.length() > 0)
                sbi.append(',');
           sbi.append("{" + key + "=" + value + "}");
           
           if(value == null){
               continue;
           }
            
           if(key.equalsIgnoreCase("RID"))
           rid = value;
           else if(key.equalsIgnoreCase("RCODE"))
           rcode = value; 
           else if(key.equalsIgnoreCase("returnos"))
                returnos = value;
       }

 

    public boolean equalsIgnoreCase(String anotherString) {

 

        return (this == anotherString) ? true :

 

               (anotherString != null) && (anotherString.count == count) &&

 

      regionMatches(true, 0, anotherString, 0, count);

 

    }

 

 

無順序性,不可移除集合元素,適用在Map族群的集合物件中 
測試是否有下一個元素 => hashMoreElements() 
指向下一個元素 => nextElement() 

 

 

 

說明參考http://jhengjyun.blogspot.tw/2010/09/java-enumeration.html 

裡頭也有解釋 Enumeration 和 Listlterator

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 JoshS 的頭像
    JoshS

    JoshS的部落格

    JoshS 發表在 痞客邦 留言(0) 人氣()