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 implied by the order of services in the registry
is maintained throughout the mining-process, as described in:
eclipse-passage#1105
  • Loading branch information
HannesWell committed Jul 4, 2022
1 parent 5856284 commit 654aecb
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 654aecb

Please sign in to comment.