EncodedDiscreteResources difference(EncodedDiscreteResources other) {
        checkArgument(this.codec.getClass() == other.codec.getClass());

        RangeSet<Integer> newRangeSet = TreeRangeSet.create(this.rangeSet);
        newRangeSet.removeAll(other.rangeSet);

        return new EncodedDiscreteResources(newRangeSet, this.codec);
    }
@Test
    public void testDifference() {
        DiscreteResource res1 = Resources.discrete(DID, PN, VID1).resource();
        DiscreteResource res2 = Resources.discrete(DID, PN, VID2).resource();
        DiscreteResource res3 = Resources.discrete(DID, PN, VID3).resource();

        EncodedDiscreteResources sut = EncodedDiscreteResources.of(ImmutableSet.of(res1, res2), new VlanIdCodec());
        EncodedDiscreteResources other = EncodedDiscreteResources.of(ImmutableSet.of(res1, res3), new VlanIdCodec());

        assertThat(sut.difference(other), is(EncodedDiscreteResources.of(ImmutableSet.of(res2), new VlanIdCodec())));
    }