code: public static <E> SetView<E> symmetricDifference(
        final Set<? extends E> set1, final Set<? extends E> set2) {
      checkNotNull(set1, "set1");
      checkNotNull(set2, "set2");
  
      return new SetView<E>() {
        @Override
        public UnmodifiableIterator<E> iterator() {
          final Iterator<? extends E> itr1 = set1.iterator();
          final Iterator<? extends E> itr2 = set2.iterator();
          return new AbstractIterator<E>() {
            @Override
            public E computeNext() {
              while (itr1.hasNext()) {
                E elem1 = itr1.next();
                if (!set2.contains(elem1)) {
                  return elem1;
                }
              }
              while (itr2.hasNext()) {
                E elem2 = itr2.next();
                if (!set1.contains(elem2)) {
                  return elem2;
                }
              }
              return endOfData();
            }
          };
        }
  
        @Override
        public int size() {
          int size = 0;
          for (E e : set1) {
            if (!set2.contains(e)) {
              size++;
            }
          }
          for (E e : set2) {
            if (!set1.contains(e)) {
              size++;
            }
          }
          return size;
        }
  
        @Override
        public boolean isEmpty() {
          return set1.equals(set2);
        }
  
        @Override
        public boolean contains(Object element) {
          return set1.contains(element) ^ set2.contains(element);
        }
      };
    }
docs: Returns an unmodifiable <b>view</b> of the symmetric difference of two sets. The returned set
  contains all elements that are contained in either {@code set1} or {@code set2} but not in
  both. The iteration order of the returned set is undefined.
  
  <p>Results are undefined if {@code set1} and {@code set2} are sets based on different
  equivalence relations (as {@code HashSet}, {@code TreeSet}, and the keySet of an {@code
  IdentityHashMap} all are).
  
  @since 3.0