### Question:
PrimitiveArrays { public static long[] symmetricDifference( long[] left, long[] right ) { if ( left == null || right == null ) { return left == null ? right : left; } assert isSortedSet( left ) && isSortedSet( right ); long uniqueCounts = countUnique( left, right ); if ( uniqueCounts == 0 ) { return EMPTY_LONG_ARRAY; } long[] difference = new long[left( uniqueCounts ) + right( uniqueCounts )]; int cursor = 0; int l = 0; int r = 0; while ( l < left.length && r < right.length ) { if ( left[l] == right[r] ) { l++; r++; } else if ( left[l] < right[r] ) { difference[cursor++] = left[l]; l++; } else { difference[cursor++] = right[r]; r++; } } while ( l < left.length ) { difference[cursor++] = left[l]; l++; } while ( r < right.length ) { difference[cursor++] = right[r]; r++; } assert cursor == difference.length; return difference; } private  PrimitiveArrays(); static int[] union( int[] lhs, int[] rhs ); static long[] intersect( long[] left, long[] right ); static long[] symmetricDifference( long[] left, long[] right ); static boolean isSortedSet( int[] set ); static boolean isSortedSet( long[] set );  }### Answer:
@Test void symDiff_shouldHandleNullInput() { assertThat( PrimitiveArrays.symmetricDifference( null, null ), equalTo( null ) ); assertThat( PrimitiveArrays.symmetricDifference( null, NO_LONGS ), equalTo( NO_LONGS ) ); assertThat( PrimitiveArrays.symmetricDifference( NO_LONGS, null ), equalTo( NO_LONGS ) ); assertThat( PrimitiveArrays.symmetricDifference( null, ONE_LONG ), equalTo( ONE_LONG ) ); assertThat( PrimitiveArrays.symmetricDifference( ONE_LONG, null ), equalTo( ONE_LONG ) ); }
@Test void symDiff_shouldHandleNonIntersectingArrays() { assertThat( PrimitiveArrays.symmetricDifference( new long[]{1, 2, 3}, new long[]{4, 5, 6} ), isArray( 1, 2, 3, 4, 5, 6 ) ); assertThat( PrimitiveArrays.symmetricDifference( new long[]{14, 15, 16}, new long[]{1, 2, 3} ), isArray( 1, 2, 3, 14, 15, 16 ) ); }
@Test void symDiff_shouldHandleIntersectingArrays() { assertThat( PrimitiveArrays.symmetricDifference( new long[]{1, 2, 3}, new long[]{3, 4, 5} ), isArray( 1, 2, 4, 5 ) ); assertThat( PrimitiveArrays.symmetricDifference( new long[]{3, 4, 5}, new long[]{1, 2, 3, 4} ), isArray( 1, 2, 5 ) ); }
@Test void symDiff_shouldHandleComplexIntersectingArraysWithGaps() { assertThat( PrimitiveArrays .symmetricDifference( new long[]{4, 6, 9, 11, 12, 15}, new long[]{2, 3, 4, 7, 8, 9, 12, 16, 19} ), isArray( 2, 3, 6, 7, 8, 11, 15, 16, 19 ) ); assertThat( PrimitiveArrays .symmetricDifference( new long[]{2, 3, 4, 7, 8, 9, 12, 16, 19}, new long[]{4, 6, 9, 11, 12, 15} ), isArray( 2, 3, 6, 7, 8, 11, 15, 16, 19 ) ); }