Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
The following is my scenario:
Set<String> cs = new HashSet<>();
cs.add(row5.c);
globalMap.put("cSet",cs);
Set<String> tcs = new HashSet<>();
cs.add(row5.tc);
globalMap.put("tcSet",tcs);
Set<String> Bn = new HashSet<>();
Bn.addAll((Set<String>)globalMap.get("cSet"));
Bn.removeAll((Set<String>)globalMap.get("tcSet"));
ERROR MESSAGE:
Exception in component tJava_2
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Set
Can anybody advise? Appreciate it so much!
Thanks for your reply, Shong.
What I want is to get the difference in those two sets. I define those two sets first and then use addAll() and removeAll() method to accomplish it, but it failed with errors. Appreciate your help!
Hi
I tested your code and it works without error, would you mind uploading your job or sending it to me via email? I will look into it further.
Regards
Shong
Thanks for your help, Shong. I just added an output following my scripts which is System.out.println(Bn), then I got what I want, thanks for your answers.