Skip to content

Commit

Permalink
Remove stream API
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbodart committed Dec 18, 2017
1 parent 4a70774 commit d70df81
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/com/googlecode/utterlyidle/UriTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static com.googlecode.totallylazy.Sequences.sequence;
import static com.googlecode.totallylazy.regex.Regex.regex;
import static com.googlecode.utterlyidle.PathParameters.pathParameters;

Expand Down Expand Up @@ -45,11 +46,8 @@ public boolean matches(final String uri) {
}

public PathParameters extract(String uri) {
List<String> values = groupValues(templateRegex.findMatches(trimSlashes(uri)).head())
.stream()
.map(UrlEncodedMessage::decode)
.collect(Collectors.toList());
return pathParameters(names.zip(values));
return pathParameters(names.zip(
sequence(groupValues(templateRegex.match(trimSlashes(uri)))).map(UrlEncodedMessage::decode)));
}

private List<String> groupValues(MatchResult matchResult) {
Expand Down

0 comments on commit d70df81

Please sign in to comment.