| contains() | ใช้ตรวจสอบว่ามี key หรือ value ที่กำหนดอยู่ใน hashtable หรือไม่ |
|---|
method:contains ( object_string );
return type:boolean
content:ใช้ตรวจสอบว่ามี key หรือ value ที่กำหนดอยู่ใน hashtable หรือไม่
example:Hashtable hash = new Hashtable (); hash.put ( "bamboo", "ไม้ไผ่" ); hash.put ( "lab", "ห้องปฏิบัติการ" ); hash.put ( "code", "รหัส" ); if ( hash.contains ( "ไม้ไผ่" ) ) { System.out.println ( "ไม้ไผ่ is in hashtable." ); }