How to check whether a Hashtable is null in Java -



How to check whether a Hashtable is null in Java -

given next java codes:

hashtable<string,integer> hs = new hashtable<string,integer>(); if(hs==null){ system.out.println("this table blank"); }

a new hashtable created no pairs. why there no output console? way, how check whether hashtable null?

the hashtable isn't null when it's empty; object still there. utilize isempty() method instead.

if (hs.isempty()){

java hashtable

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -