Iterator接口用法举例 import java. util. *; public class Test { public static void main(String[] args) { Array. List h = new Array. List(); h. add("1 st"); h. add("2 nd"); h. add(new Integer(3)); h. add(new Double(4. 0)); Iterator it = h. iterator(); while ( it. has. Next() ) { System. out. println(it. next()); } }
Properties类 类似Hash. Map • Key, value
Properties类 import java. util. *; class Prop. Test{ public static void main(String[] args) { Properties pps=new Properties(); try { pps. load(new File. Input. Stream("d: \test. properties")); Enumeration em=pps. property. Names(); //枚举类 while(em. has. More. Elements()) { String str. Key=(String)em. next. Element(); //em. . next. Element()返回Object类 String str. Value=pps. get. Property(str. Key); System. out. println(str. Key+"="+str. Value); } }catch(Exception e){ e. pri nt. Stack. Trace(); } } }