I've been trying to store a stack in SharedPreferences as a set through the
putStringSet(KEY, new LinkedHashSet(stack));
You can convert your stack elements to a comma separated String and then use putString to save it.
For example, if your stack contains the following:
| "4" | | "3" | | "2" | | "1" | | "0" | -------
You should convert it to the String "0,1,2,3,4" and save it to
To rebuild your stack, get the String from the
SharedPreferences, split it by the comma separator and push it in order to the stack.