I'm working on a project, and need to optimize the running time. Is String.contains()
runtime the same as TreeSet.contains()
, which is O(logN)?
The reason I'm asking is I'm building a TreeMap<String, TreeSet<Song>>
, where Songs contain a String of lyrics. Depending on the efficiency, I am considering including a Set of the lyric words inside the Song and running searches on that rather than the String.