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 trialGregorio Massara
3,544 PointsstateCodesAreSorted Test Fails in the ranges stream challenge.
this is a snippet of my stream() function
If someone could point me in the right direction as it looks like I am missing something here!
public static List<String> getStateCodesFromRecords(List<HousingRecord> records) { // TODO: Open a stream on records // TODO: Map the stream to the state code // TODO: Filter out any records without a state // TODO: There are duplicate state codes in the records, make sure we have a unique representation // TODO: Sort them alphabetically // TODO: Collect them into a new list.
return records.stream()
.map(HousingRecord::getState)
.filter(String::isEmpty)
.distinct()
.sorted(String::compareTo)
.collect(Collectors.toList());
}
1 Answer
Neslihan Kara
11,259 Pointshey I found a solution for your little errors , hope it works. For me I forgot to add +1 to stateCode.size() for the other method.