I have a few strings(about 100) and I want to store them in a Data Structure and then later I want to search it for a particular string to check whether its present or not. What DS in Java will be best in this case for fast searching.
The actual use case is that I want to create a catalog for books and need to find out whether a particular title is present or not.
All the strings are unique. I dont want to implement any DS myself but want to use any of the Collections already present in Java.
why don’t you use any List to store all the strings and use contains() method to find whether it present in your List or not.
You can even use Set but in that case your strings must be unique.