Make use of the fact that CompoundRequestMapper implements Iterable
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/f7bfda2e Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/f7bfda2e Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/f7bfda2e Branch: refs/heads/master Commit: f7bfda2ebe8dd04a8452e141720e03c82d26caf3 Parents: 3cf9e86 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Mon Mar 13 21:33:18 2017 +0100 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Mon Mar 20 21:42:32 2017 +0100 ---------------------------------------------------------------------- .../apache/wicket/request/mapper/CompoundRequestMapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/f7bfda2e/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java ---------------------------------------------------------------------- diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java index c4007e8..68a4b38 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java @@ -128,7 +128,7 @@ public class CompoundRequestMapper implements ICompoundRequestMapper { List<MapperWithScore> list = new ArrayList<>(mappers.size()); - for (IRequestMapper mapper : mappers) + for (IRequestMapper mapper : this) { int score = mapper.getCompatibilityScore(request); list.add(new MapperWithScore(mapper, score)); @@ -205,7 +205,7 @@ public class CompoundRequestMapper implements ICompoundRequestMapper @Override public Url mapHandler(final IRequestHandler handler) { - for (IRequestMapper mapper : mappers) + for (IRequestMapper mapper : this) { Url url = mapper.mapHandler(handler); if (url != null) @@ -225,7 +225,7 @@ public class CompoundRequestMapper implements ICompoundRequestMapper public int getCompatibilityScore(final Request request) { int score = Integer.MIN_VALUE; - for (IRequestMapper mapper : mappers) + for (IRequestMapper mapper : this) { score = Math.max(score, mapper.getCompatibilityScore(request)); }
