diff --git a/community/primitive-collections/src/main/java/org/neo4j/collection/primitive/PrimitiveSortedArraySet.java b/community/primitive-collections/src/main/java/org/neo4j/collection/primitive/PrimitiveSortedArraySet.java
new file mode 100644
index 0000000000000..c1efbf4418601
--- /dev/null
+++ b/community/primitive-collections/src/main/java/org/neo4j/collection/primitive/PrimitiveSortedArraySet.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2002-2017 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.collection.primitive;
+
+import java.util.Arrays;
+
+public class PrimitiveSortedArraySet
+{
+ /**
+ * Merges two sets of integers represented as sorted arrays.
+ *
+ * @param lhs
+ * a set of integers, represented as a sorted array.
+ * @param rhs
+ * a set of integers, represented as a sorted array.
+ * @return a set of integers, represented as a sorted array.
+ */
+ public static int[] mergeSortedSet( int[] lhs, int[] rhs )
+ {
+ if ( lhs.length < rhs.length )
+ {
+ return mergeSortedSet( rhs, lhs );
+ }
+ int[] merged = null;
+ int m = 0;
+ for ( int l = 0, r = 0; l < lhs.length && r < rhs.length; )
+ {
+ while ( l < lhs.length && lhs[l] < rhs[r] )
+ {
+ if ( merged != null )
+ {
+ merged[m++] = lhs[l];
+ }
+ l++;
+ }
+ if ( l == lhs.length )
+ {
+ if ( merged == null )
+ {
+ merged = Arrays.copyOf( lhs, lhs.length + rhs.length - r );
+ m = l;
+ }
+ System.arraycopy( rhs, r, merged, m, rhs.length - r );
+ m += rhs.length - r;
+ break;
+ }
+ if ( lhs[l] > rhs[r] )
+ {
+ if ( merged == null )
+ {
+ merged = Arrays.copyOf( lhs, lhs.length + rhs.length - r );
+ m = l;
+ }
+ merged[m++] = rhs[r++];
+ }
+ else // i.e. ( lhs[l] == rhs[r] )
+ {
+ if ( merged != null )
+ {
+ merged[m++] = lhs[l];
+ }
+ l++;
+ r++;
+ }
+ }
+ if ( merged == null )
+ {
+ return lhs;
+ }
+ if ( merged.length < m )
+ {
+ merged = Arrays.copyOf( merged, m );
+ }
+ return merged;
+ }
+}
diff --git a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/PropertyExistenceEnforcerMergeTest.java b/community/primitive-collections/src/test/java/org/neo4j/collection/primitive/PrimitiveSortedArraySetTest.java
similarity index 84%
rename from enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/PropertyExistenceEnforcerMergeTest.java
rename to community/primitive-collections/src/test/java/org/neo4j/collection/primitive/PrimitiveSortedArraySetTest.java
index 82a6ff76318ab..e84dbdddbef2e 100644
--- a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/PropertyExistenceEnforcerMergeTest.java
+++ b/community/primitive-collections/src/test/java/org/neo4j/collection/primitive/PrimitiveSortedArraySetTest.java
@@ -5,19 +5,19 @@
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-package org.neo4j.kernel.impl.enterprise;
+package org.neo4j.collection.primitive;
import java.util.Arrays;
@@ -27,10 +27,10 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertSame;
-import static org.neo4j.kernel.impl.enterprise.PropertyExistenceEnforcer.merge;
+import static org.neo4j.collection.primitive.PrimitiveSortedArraySet.mergeSortedSet;
@RunWith( Parameterized.class )
-public class PropertyExistenceEnforcerMergeTest
+public class PrimitiveSortedArraySetTest
{
@Parameterized.Parameters( name = "{0}" )
public static Iterable