Best data structure for this?

I want to keep a record of a load of Strings, and everytime a new String is added i want to know if it has previously been added.

Obviously a silly method would be to just store each String in an arraylist and then search through it each time but this will be too slow once the list starts getting big.

Could there be a better way of doing this?

[364 byte] By [Unconditionala] at [2007-11-27 2:02:23]
# 1
Store each String into a HashSet. Every time before you add it, you check if it already exists.(Or, more efficiently, just use the return value of HashSet.add() method to see if it was a new addition or an existing element)
KathyMcDonnella at 2007-7-12 1:43:41 > top of Java-index,Java Essentials,Java Programming...