Skip to content

Commit d70df81

Browse files
committed
Remove stream API
1 parent 4a70774 commit d70df81

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/com/googlecode/utterlyidle/UriTemplate.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.regex.Pattern;
1313
import java.util.stream.Collectors;
1414

15+
import static com.googlecode.totallylazy.Sequences.sequence;
1516
import static com.googlecode.totallylazy.regex.Regex.regex;
1617
import static com.googlecode.utterlyidle.PathParameters.pathParameters;
1718

@@ -45,11 +46,8 @@ public boolean matches(final String uri) {
4546
}
4647

4748
public PathParameters extract(String uri) {
48-
List<String> values = groupValues(templateRegex.findMatches(trimSlashes(uri)).head())
49-
.stream()
50-
.map(UrlEncodedMessage::decode)
51-
.collect(Collectors.toList());
52-
return pathParameters(names.zip(values));
49+
return pathParameters(names.zip(
50+
sequence(groupValues(templateRegex.match(trimSlashes(uri)))).map(UrlEncodedMessage::decode)));
5351
}
5452

5553
private List<String> groupValues(MatchResult matchResult) {

0 commit comments

Comments
 (0)