//Print all values from hash table
public static void PrintHashTableValue( Hashtable hashTableVar )
{
Collection valueCollection = hashTableVar.values();
Object hashTablevalueObject[] = valueCollection.toArray();
for ( Object hashValueObject : hashTablevalueObject )
{
System.out.println( hashValueObject );
}
}
//Print key and value from hashtable
public static void PrintHashTableKeyPair(Hashtable hashTableVariable)
{
Enumeration hashTableKeys = hashTableVariable.hashTableKeys();
while (hashTableKeys.hasMoreElements())
{
Object hashTableKey = hashTableKeys.nextElement();
System.out.println(" Key :" + hashTableKey + " Value: " + hashTableVariable.get(hashTableKey));
}
}
Simply You can use it like this :
Set s = hastable.entrySet();
Iterator it = s.iterator();
while (it.hasNext())
{
System.out.println(it.next());
}
public static void PrintHashTableValue( Hashtable hashTableVar )
{
Collection valueCollection = hashTableVar.values();
Object hashTablevalueObject[] = valueCollection.toArray();
for ( Object hashValueObject : hashTablevalueObject )
{
System.out.println( hashValueObject );
}
}
//Print key and value from hashtable
public static void PrintHashTableKeyPair(Hashtable hashTableVariable)
{
Enumeration hashTableKeys = hashTableVariable.hashTableKeys();
while (hashTableKeys.hasMoreElements())
{
Object hashTableKey = hashTableKeys.nextElement();
System.out.println(" Key :" + hashTableKey + " Value: " + hashTableVariable.get(hashTableKey));
}
}
Simply You can use it like this :
Set s = hastable.entrySet();
Iterator it = s.iterator();
while (it.hasNext())
{
System.out.println(it.next());
}
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......