Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static Collection<? extends RequestParam> distinct(Collection<? extends RequestP
return origParams
.stream()
.filter(Objects::nonNull)
.collect(Collectors.toMap(RequestParam::getName, a -> a, (s1, s2) -> s1))
.collect(Collectors.toMap(RequestParam::getValue, a -> a, (s1, s2) -> s1))

@vvmsalat vvmsalat Jul 3, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexeyOnGitHub like this, different
RequestParam{name='f[]', value='status_id'
RequestParam{name='f[]', value='cf_13' can be filtered, which is total need.
Still, if ever duplicate values occure, the map would skip one entry. Ideally the key/value pair should be duplicate checked.
But that's it for the moment.

.values();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public void testDistinctWithDuplicateParams() {
}

@Test
public void testDistinctWithSimilarNames() {
public void testDistinctWithSimilarNamesButDifferentValues() {
List<RequestParam> params = Arrays.asList(param2, param2WithDifferentValue);
assertThat(URIConfigurator.distinct(params)).containsOnly(param2);
assertThat(URIConfigurator.distinct(params)).containsOnly(param2, param2WithDifferentValue);
}

@Test
Expand Down