Welcome to the Treehouse Community
Looking to learn something new?
Damion Keddie5,036 Points
Where does C# go?
Hey all, time for a first question, though it's not really programming related. At the 6 minute mark in the video 'Sets', the language C# is added to the uniqueLanguages set, but at about 6.45 when we are being shown sorted sets, it has disappeared! Ghosts or an editing snafu?
In this line:
SortedSet<String> uniqueLanguages = new TreeSet<String>(allLanguages)
uniqueList variable is assigned to a new
TreeSet, meaning that they replaced the current
Set that existed within the variable with the new
SortedSet. Since the
allLanguages list is passed in during its creating the list ends up not empty even though it was recreated, but it will only contain the items in the
allLanguages list, the items assigned to it previously will disappear since the variable was reassigned to a completely new
So to answer your question it's neither a dodgy edit or a bug.