E
 the type of an element in the setspublic final class Diff<E>
extends java.lang.Object
added
, removed
, and unchanged
elements) is
computed against the first set.
Example of usage:
Set<Integer> set1 = ... // { 1, 3, <strong>5</strong>, <strong>7</strong> } Set<Integer> set2 = ... // { <strong>5</strong>, 6, <strong>7</strong>, 8, 9 } <strong>Diff<</strong>Integer<strong>> diff</strong> = <strong>Diff.of(</strong>set1, set2<strong>)</strong>; Set<Integer> added = <strong>diff.added()</strong> // { 6, 8, 9 } Set<Integer> removed = <strong>diff.removed()</strong> // { 1, 3 } Set<Integer> unchanged = <strong>diff.unchanged()</strong> // { 5, 7 } // set2 == set1 + added  removed
Modifier and Type  Method and Description 

java.util.Set<? extends E> 
added()
Returns the set of elements that are missing in the first set, but are
present in the second set (they need to be added into the first set).

static <E> Diff<E> 
of(java.util.Set<? extends E> set1,
java.util.Set<? extends E> set2)

java.util.Set<? extends E> 
removed()
Returns the set of elements that are present in the first set, but are
missing in the second set (they need to be removed from the first set).

java.util.Set<? extends E> 
unchanged()
Returns the set of elements that exist in both sets being compared.

public static <E> Diff<E> of(java.util.Set<? extends E> set1, java.util.Set<? extends E> set2)
public java.util.Set<? extends E> added()
public java.util.Set<? extends E> removed()
public java.util.Set<? extends E> unchanged()
Copyright © 20072020 Whitestein Technologies. All Rights Reserved.