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! While you're at it, check out some resources Treehouse students have shared here.
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 trialindraneel
2,211 PointsgetAvailableContactMethods
Hi, I am facing an error at this stage. Given below is the code.
public Set<String> getAvailableContactMethods() {
// FIXME: This should return the current contact method names.
Set <String> contactMethods = new HashSet<String>();
for (Map.Entry e : mContactMethods.entrySet()) {
contactMethods.add(e.getKey());
}
return contactMethods;
}
1 Answer
Brendon Butler
4,254 PointsAfter Map.Entry you need to add <String, String> if I'm not mistaken. If that doesn't work, please leave a comment containing your error from the "Preview" tab.
indraneel
2,211 Pointsindraneel
2,211 PointsBrendon Butler
4,254 PointsBrendon Butler
4,254 PointsSorry for the late response, I was at work. And it looks like my answer excluded what I wanted to include because it thought it was HTML code. You need to have this:
Map.Entry<String, String> e
instead of
Map.Entry e
You might have missed that in the tutorial, and there's no problem with that. That error it gave you was hard to understand even for me. I thought there was actually other problems, but I tested it and what I thought was wrong, wasn't.