keySet()
is a method that returns a set of all the keys of the Map(public Set<K> keySet ())
. So, methods are not to be imported. Though Map is not imported but the return type of getAll()
method is Map<String, ?>
so it can be directly accessed.
If you fetch getAll()
seperately like,
Map<String, ?> map = preferences.getAll();
Then you will have Map imported else you can directly access it.