Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Chaz Hall1,970 Points
I'm trying to understand the .contains. I understand that it compares one string to another word(s) in another string, but what other functions does it have? Thanks!
Really when speaking about Strings that is the only thing that it does, checks and see if the sub string that we pass as an argument is contained in the main string.
Though there is a contains method on ArrayLists that let us check if an Object is contained in that arrayList.
And maps have something similar with the containsKey or ContainsValue, but essentially they all do the same check.
They check to see if the passed argument is contained in the object that we passed in.
Thanks, hope this helps.