| hasMoreElements() | ใช้ตรวจสอบว่ายังมีข้อมูลอยู่ใน Enumeration อีกหรือไม่ |
|---|---|
| nextElement() | ใช้คืนค่า ข้อความของ enumeration ตำแหน่งปัจจุบัน และเลื่อนไปยังตำแหน่งถัดไป |
method:hasMoreElements ();
return type:boolean
content:ใช้ตรวจสอบว่ายังมีข้อมูลอยู่ใน Enumeration อีกหรือไม่
example:Hashtable hash = new Hashtable (); hash.put ( "bamboo", "ไม้ไผ่" ); hash.put ( "lab", "ห้องปฏิบัติการ" ); hash.put ( "code", "รหัส" ); Enumeration enumeration = hash.key (); if ( enumeration.hasMoreElements () ) { System.out.println ( enumeration.nextElement() ); }
method:nextElement ();
return type:Object
content:ใช้คืนค่า ข้อความของ enumeration ตำแหน่งปัจจุบัน และเลื่อนไปยังตำแหน่งถัดไป
example:Hashtable hash = new Hashtable (); hash.put ( "bamboo", "ไม้ไผ่" ); hash.put ( "lab", "ห้องปฏิบัติการ" ); hash.put ( "code", "รหัส" ); Enumeration enumeration = hash.key (); if ( enumeration.hasMoreElements () ) { System.out.println ( enumeration.nextElement() ); }