For example, you can keep all entered texts in the instance of the
You need to check of the string is already in set and, if it is not, add a new one. This collection types provides time complexity
If you want to persist the set of string, you can save it in file and restore back on application start.
It could be as simple as plain text file (for strings without end-of-line characters) or some XML, something like that.