a test This is
a test this This is
The Set
represents a unique set of items... for example:
- The Letters of the Alphabet
- The Numbers in a numbering system
- List of available Colors
Set differs from a List
in that the items or entities in a Set are unique with no ambiguity. Therefore, a set can not contain duplicates... well... not in the strictest sense. Lets look closer...
Let us add this string to a set. "This is a test" adding each word seperately.
If we print the set it will look like this:
Now add the word this again and the output will look like this:
That means the list is case sensitive and sees this and This as two different words. That makes sense Java is case sensitive.
When we add the word in the original case This it never gets added because the Set rejects it.