I'm trying to initialize Set<String> variable during the debug session in eclipse. So I right-click on the variable to change and in "Change Object Value" window type the following expression:
new HashSet<String>(Arrays.asList(new String[]{"a", "b"}));
Eclipse returns the following error:
HashSet cannot be resolved to a type
Arrays cannot be resolved
Is there any way to initialize a collection during debug session in eclipse ?
If you want to use a class that is not imported (no corresponding import statement in the current file), then you can use these classes by their fully qualified names:
new java.util.HashSet<String>(java.util.Arrays.asList(new String[]{"a", "b"}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With