Skip to content

Commit

Permalink
Maintain collection-order in FeatureFilter and FeatureConditionPack
Browse files Browse the repository at this point in the history
This ensure the order of mined conditions is maintained throughout the
process, as described in:
eclipse-passage#1105
  • Loading branch information
HannesWell committed Jul 1, 2022
1 parent f944890 commit 07e2e44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;
Expand Down Expand Up @@ -56,7 +57,7 @@ private Collection<T> filter(Collection<T> targets) {
.map(target -> map.apply(target, feature))//
.filter(Optional::isPresent) //
.map(Optional::get) //
.collect(Collectors.toSet());
.collect(Collectors.toCollection(LinkedHashSet::new));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.eclipse.passage.lic.base.conditions;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -49,7 +50,7 @@ public Collection<Condition> conditions() {
// FIXME: work for CachingFunction
return parent.conditions().stream()//
.filter(condition -> condition.feature().equals(feature))//
.collect(Collectors.toSet());
.collect(Collectors.toCollection(LinkedHashSet::new));
}

@Override
Expand Down

0 comments on commit 07e2e44

Please sign in to comment.