diff --git a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java index e5300b63..a4781420 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java @@ -30,7 +30,8 @@ import java.util.Arrays; import java.util.Collection; -import java.util.HashSet; +import java.util.Collections; +import java.util.LinkedHashSet; import java.util.Set; /** @@ -47,11 +48,12 @@ public IsIn() { } public IsIn(final Collection controlData) { - this.allowedValues = new HashSet<>(controlData); + this.allowedValues = new LinkedHashSet<>(controlData); } public IsIn(final Object... controlData) { - this.allowedValues = Sets.newHashSet(controlData); + this.allowedValues = Sets.newLinkedHashSet(); + Collections.addAll(this.allowedValues, controlData); } @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.WRAPPER_OBJECT) @@ -64,9 +66,9 @@ public Object[] getAllowedValuesArray() { @JsonProperty("values") public void setAllowedValues(final Object[] allowedValuesArray) { if (null != allowedValuesArray) { - allowedValues = new HashSet<>(Arrays.asList(allowedValuesArray)); + allowedValues = new LinkedHashSet<>(Arrays.asList(allowedValuesArray)); } else { - allowedValues = new HashSet<>(0); + allowedValues = new LinkedHashSet<>(0); } }