You can use HashSet<String> or ArrayList<String> , which has a contains method. It will check if your string is saved or not.
The difference between a HashSet and an ArrayList - hashset will not allow duplication of value, and it will not maintain order, while arraylist will allow you to duplicate and ordered collection. But a HashSet is more efficient than an arraylist for performing search operations.
source share