Skip to content

Commit

Permalink
Restore old sorting behaviour
Browse files Browse the repository at this point in the history
- In #946 we added new ways to add items to single selector while still
  keeping Map<String, String>. Order to keep old sorting behaviour
  we try to pass incoming map via new HashMap as that was a way it
  worked. This should limit risks for breaking things in a patch release.
  • Loading branch information
jvalkeal committed Dec 23, 2023
1 parent 4eab8be commit cb8f44f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
Expand Down Expand Up @@ -81,7 +82,11 @@ public SingleItemSelectorSpec selectItem(String name, String item) {

@Override
public SingleItemSelectorSpec selectItems(Map<String, String> selectItems) {
List<SelectItem> items = selectItems.entrySet().stream()
// TODO: we changed to keep items as SelectItem's, to try to keep old sorting
// behaviour we go via HashMap gh-946. Later we should remove this step.
Map<String, String> selectItemsMap = new HashMap<>();
selectItemsMap.putAll(selectItems);
List<SelectItem> items = selectItemsMap.entrySet().stream()
.map(e -> SelectItem.of(e.getKey(), e.getValue()))
.collect(Collectors.toList());
selectItems(items);
Expand Down

0 comments on commit cb8f44f

Please sign in to comment.