Results 1 to 2 of 2
- 11-04-2010, 06:09 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 9
- Rep Power
- 0
Test for all empty Strings in LinkedHashMap<String,ArrayList<String>
For the LinkedHashMap<String,ArrayList<String> data type, how to find out whether all the Strings in ArrayList are empty/null?
I tried the following code:
Output is:Java Code:public void setProductList(LinkedHashMap<String,ArrayList<String>> productList) { Set st = productList.keySet(); Collection<ArrayList<String>> st2 = productList.values(); // what should be the code to find out whether all the Strings in st2 are empty/null? System.out.println("productList " +productList + " size " + productList.size() ); System.out.println("st " + st.size()); System.out.println("st2 size " + st2.size()); System.out.println("st2 " + st2); System.out.println("st2 null " + st2.containsAll(null)); }
productList {PC=[], Mac=[]} size 2
st 2
st2 size 2
st2 [[], []]
What should be the code to find out whether all the Strings in st2 are empty/null?Last edited by albertkao; 11-04-2010 at 06:30 PM.
- 11-04-2010, 06:53 PM #2
Similar Threads
-
How to match arrayList with a String?
By Lund01 in forum Advanced JavaReplies: 2Last Post: 10-14-2010, 02:07 PM -
Problem with empty search string
By virendra in forum LuceneReplies: 0Last Post: 01-06-2010, 10:42 AM -
how to at strings to a string like a table
By petrosgraf in forum New To JavaReplies: 14Last Post: 09-24-2009, 12:00 AM -
NumberFormatException: empty String
By svpriyan in forum New To JavaReplies: 1Last Post: 08-12-2009, 10:46 AM -
Putting a string into ArrayList<String>
By k4ff1n34dd1c7 in forum New To JavaReplies: 5Last Post: 03-23-2009, 05:10 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks