So, you will return to String[] . Anyone who has no arguments returns Object[] .
You have 2 versions of this method:
By passing the String[] array, you are using the generic version.
The best way to pass an array to String[] is to initialize it with a size of Set , rather than a size of 0, so there is no need to create a new array in the method:
Set<String> set = saved.getAll().keySet(); String[] mystring = set.toArray(new String[set.size()]);
Rohit jain
source share