code: Set<E> union(final SmallSet<E> s) {
          if ((s.e1 == e1 && s.e2 == e2) || (s.e1 == e2 && s.e2 == e1)) {
              return this; // if the two sets are equal, return this
          }
          if (s.e1 == null) {
              return this; // if s is empty, return this
          }
          if (e1 == null) {
              return s; // if this is empty, return s
          }
          if (s.e2 == null) { // s contains exactly one element
              if (e2 == null) {
                  return new SmallSet<E>(e1, s.e1); // necessarily e1 != s.e1
              } else if (s.e1 == e1 || s.e1 == e2) { // s is included in this
                  return this;
              }
          }
          if (e2 == null) { // this contains exactly one element
              // if (s.e2 == null) { // cannot happen
              // return new SmallSet(e1, s.e1); // necessarily e1 != s.e1
              // } else
              if (e1 == s.e1 || e1 == s.e2) { // this in included in s
                  return s;
              }
          }
          // here we know that there are at least 3 distinct elements
          HashSet<E> r = new HashSet<E>(4);
          r.add(e1);
          if (e2 != null) {
              r.add(e2);
          }
          r.add(s.e1);
          if (s.e2 != null) {
              r.add(s.e2);
          }
          return r;
      }
docs: -------------------------------------------------------------------------