Android Hashtable Display printHash(Hashtable ht)

Here you can find the source of printHash(Hashtable ht)

Description

print Hash

Declaration

public static String printHash(Hashtable ht) 

Method Source Code

//package com.java2s;
import java.util.Enumeration;
import java.util.Hashtable;

public class Main {
    public static String printHash(Hashtable ht) {
        StringBuffer sb = new StringBuffer("");
        if (ht != null && !ht.isEmpty()) {
            sb.append("Contents of Hashtable:\n");
            Enumeration en = ht.keys();
            while (en.hasMoreElements()) {
                String k = (String) en.nextElement();
                sb.append("* " + k + " = ");
                sb.append(ht.get(k).toString());
                sb.append("\n");
            }//from   w  ww  .j av a  2 s  .  co  m
        }
        return sb.toString();
    }
}