educative.io

Keeping all the TweetIDs in a HashSet

Notice that we are keeping all the TweetIDs in a HashSet; this will enable us to add/remove tweets from our index quickly.

Why do we need to remove tweets from the index quickly? Is this for when someone deletes a tweet?

Hi @Dewey_Munoz

Your question, apparently, has two components, so I am going to answer them accordingly.

We need to remove tweet from our index server in case a user deletes a tweet, and as all the TweetIDs are stored in a HashSet, it gives us a computational advantage, and hence the word quickly.