Merge branch '2.0.X'
diff --git a/pom.xml b/pom.xml
index 93ca18b..f5ab892 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
 
   <groupId>org.apache.datasketches</groupId>
   <artifactId>datasketches-java</artifactId>
-  <version>1.4.0-SNAPSHOT</version>
+  <version>2.0.0</version>
   <packaging>jar</packaging>
 
   <name>${project.artifactId}</name>
diff --git a/src/main/java/org/apache/datasketches/theta/AnotB.java b/src/main/java/org/apache/datasketches/theta/AnotB.java
index c194cd6..7ecc3bd 100644
--- a/src/main/java/org/apache/datasketches/theta/AnotB.java
+++ b/src/main/java/org/apache/datasketches/theta/AnotB.java
@@ -108,20 +108,21 @@
   public abstract void notB(Sketch skB);
 
   /**
-   * Gets the result of the mutistep, stateful operation AnotB that have been executed with calls
+   * Gets the result of the multistep, stateful operation AnotB that have been executed with calls
    * to {@link #setA(Sketch)} and ({@link #notB(Sketch)} or
    * {@link #notB(org.apache.datasketches.theta.Sketch)}).
    *
    * @param reset If <i>true</i>, clears this operator to the empty state after this result is
    * returned. Set this to <i>false</i> if you wish to obtain an intermediate result.
+   *
    * @return the result of this operation as an ordered, on-heap {@link CompactSketch}.
    */
   public abstract CompactSketch getResult(boolean reset);
 
   /**
-   * Gets the result of this stateful set operation as a CompactSketch of the form based on
-   * the input arguments.
-   * The stateful input operations are {@link #setA(Sketch)} and {@link #notB(Sketch)}.
+   * Gets the result of the multistep, stateful operation AnotB that have been executed with calls
+   * to {@link #setA(Sketch)} and ({@link #notB(Sketch)} or
+   * {@link #notB(org.apache.datasketches.theta.Sketch)}).
    *
    * @param dstOrdered If <i>true</i>, the result will be an ordered {@link CompactSketch}.
    * <a href="{@docRoot}/resources/dictionary.html#dstOrdered">See Destination Ordered</a>.
@@ -132,7 +133,7 @@
    * @param reset If <i>true</i>, clears this operator to the empty state after this result is
    * returned. Set this to <i>false</i> if you wish to obtain an intermediate result.
    *
-   * @return the result of this operation as a {@link CompactSketch} of the chosen form.
+   * @return the result of this operation as a {@link CompactSketch} in the given dstMem.
    */
   public abstract CompactSketch getResult(boolean dstOrdered, WritableMemory dstMem, boolean reset);
 
diff --git a/src/main/java/org/apache/datasketches/theta/Intersection.java b/src/main/java/org/apache/datasketches/theta/Intersection.java
index 9c7e16a..b9dc47e 100644
--- a/src/main/java/org/apache/datasketches/theta/Intersection.java
+++ b/src/main/java/org/apache/datasketches/theta/Intersection.java
@@ -50,7 +50,10 @@
 
   /**
    * Gets the result of this operation as an ordered CompactSketch on the Java heap.
-   * The {@link #intersect(Sketch)} method must have been called at least once.
+   * This does not disturb the underlying data structure of this intersection.
+   * The {@link #intersect(Sketch)} method must have been called at least once, otherwise an
+   * exception will be thrown. This is because a virgin Intersection object represents the
+   * Universal Set, which has an infinite number of values.
    * @return the result of this operation as an ordered CompactSketch on the Java heap
    */
   public CompactSketch getResult() {
@@ -58,7 +61,8 @@
   }
 
   /**
-   * Gets the result of this operation as a CompactSketch of the chosen form.
+   * Gets the result of this operation as a CompactSketch in the given dstMem.
+   * This does not disturb the underlying data structure of this intersection.
    * The {@link #intersect(Sketch)} method must have been called at least once, otherwise an
    * exception will be thrown. This is because a virgin Intersection object represents the
    * Universal Set, which has an infinite number of values.
@@ -70,14 +74,14 @@
    *
    * <p>Presenting an intersection with a null argument will throw an exception.</p>
    *
-   *
    * @param dstOrdered
    * <a href="{@docRoot}/resources/dictionary.html#dstOrdered">See Destination Ordered</a>
    *
    * @param dstMem
    * <a href="{@docRoot}/resources/dictionary.html#dstMem">See Destination Memory</a>.
    *
-   * @return the result of this operation as a CompactSketch of the chosen form
+   * @return the result of this operation as a CompactSketch stored in the given dstMem,
+   * which can be either on or off-heap..
    */
   public abstract CompactSketch getResult(boolean dstOrdered, WritableMemory dstMem);
 
@@ -90,7 +94,7 @@
   /**
    * Resets this Intersection for stateful operations only.
    * The seed remains intact, otherwise reverts to
-   * the Universal Set, theta of 1.0 and empty = false.
+   * the Universal Set: theta = 1.0, no retained data and empty = false.
    */
   public abstract void reset();
 
diff --git a/src/main/java/org/apache/datasketches/theta/IntersectionImpl.java b/src/main/java/org/apache/datasketches/theta/IntersectionImpl.java
index b511409..4a8811c 100644
--- a/src/main/java/org/apache/datasketches/theta/IntersectionImpl.java
+++ b/src/main/java/org/apache/datasketches/theta/IntersectionImpl.java
@@ -219,7 +219,7 @@
   @Override
   public CompactSketch intersect(final Sketch a, final Sketch b, final boolean dstOrdered,
      final WritableMemory dstMem) {
-    if ((wmem_ != null) && readOnly_) { throw new SketchesReadOnlyException(); }
+    if (wmem_ != null && readOnly_) { throw new SketchesReadOnlyException(); }
     hardReset();
     intersect(a);
     intersect(b);
@@ -233,7 +233,7 @@
     if (sketchIn == null) {
       throw new SketchesArgumentException("Intersection argument must not be null.");
     }
-    if ((wmem_ != null) && readOnly_) { throw new SketchesReadOnlyException(); }
+    if (wmem_ != null && readOnly_) { throw new SketchesReadOnlyException(); }
     if (empty_ || sketchIn.isEmpty()) { //empty rule
       //Because of the def of null above and the Empty Rule (which is OR), empty_ must be true.
       //Whatever the current internal state, we make our local empty.
@@ -262,14 +262,14 @@
     final int sketchInEntries = sketchIn.getRetainedEntries(true);
 
     //states 1,2,3,6
-    if ((curCount_ == 0) || (sketchInEntries == 0)) {
+    if (curCount_ == 0 || sketchInEntries == 0) {
       curCount_ = 0;
       if (wmem_ != null) { insertCurCount(wmem_, 0); }
       hashTable_ = null; //No need for a HT. Don't bother clearing mem if valid
     } //end of states 1,2,3,6
 
     // state 5
-    else if ((curCount_ < 0) && (sketchInEntries > 0)) {
+    else if (curCount_ < 0 && sketchInEntries > 0) {
       curCount_ = sketchIn.getRetainedEntries(true);
       final int requiredLgArrLongs = minLgHashTableSize(curCount_, REBUILD_THRESHOLD);
       final int priorLgArrLongs = lgArrLongs_; //prior only used in error message
@@ -295,7 +295,7 @@
     } //end of state 5
 
     //state 7
-    else if ((curCount_ > 0) && (sketchInEntries > 0)) {
+    else if (curCount_ > 0 && sketchInEntries > 0) {
       //Sets resulting hashTable, curCount and adjusts lgArrLongs
       performIntersect(sketchIn);
     } //end of state 7
@@ -340,6 +340,16 @@
   }
 
   @Override
+  public boolean hasResult() {
+    return wmem_ != null ? wmem_.getInt(RETAINED_ENTRIES_INT) >= 0 : curCount_ >= 0;
+  }
+
+  @Override
+  public boolean isSameResource(final Memory that) {
+    return wmem_ != null ? wmem_.isSameResource(that) : false;
+  }
+
+  @Override
   public void reset() {
     hardReset();
   }
@@ -347,7 +357,7 @@
   @Override
   public byte[] toByteArray() {
     final int preBytes = CONST_PREAMBLE_LONGS << 3;
-    final int dataBytes = (curCount_ > 0) ? 8 << lgArrLongs_ : 0;
+    final int dataBytes = curCount_ > 0 ? 8 << lgArrLongs_ : 0;
     final byte[] byteArrOut = new byte[preBytes + dataBytes];
     if (wmem_ != null) {
       wmem_.getByteArray(0, byteArrOut, 0, preBytes + dataBytes);
@@ -376,16 +386,6 @@
     return byteArrOut;
   }
 
-  @Override
-  public boolean hasResult() {
-    return (wmem_ != null) ? wmem_.getInt(RETAINED_ENTRIES_INT) >= 0 : curCount_ >= 0;
-  }
-
-  @Override
-  public boolean isSameResource(final Memory that) {
-    return (wmem_ != null) ? wmem_.isSameResource(that) : false;
-  }
-
   //restricted
 
   /**
@@ -405,7 +405,7 @@
   @Override
   long[] getCache() {
     if (wmem_ == null) {
-      return (hashTable_ != null) ? hashTable_ : new long[0];
+      return hashTable_ != null ? hashTable_ : new long[0];
     }
     //Direct
     final int arrLongs = 1 << lgArrLongs_;
@@ -426,7 +426,7 @@
 
   private void performIntersect(final Sketch sketchIn) {
     // curCount and input data are nonzero, match against HT
-    assert ((curCount_ > 0) && (!empty_));
+    assert curCount_ > 0 && !empty_;
     final long[] cacheIn = sketchIn.getCache();
     final int arrLongsIn = cacheIn.length;
     final long[] hashTable;
@@ -458,7 +458,7 @@
       //either unordered compact or hash table
       for (int i = 0; i < arrLongsIn; i++ ) {
         final long hashIn = cacheIn[i];
-        if ((hashIn <= 0L) || (hashIn >= thetaLong_)) { continue; }
+        if (hashIn <= 0L || hashIn >= thetaLong_) { continue; }
         final int foundIdx = hashSearch(hashTable, lgArrLongs_, hashIn);
         if (foundIdx == -1) { continue; }
         matchSet[matchSetCount++] = hashIn;
@@ -505,7 +505,7 @@
         tmpCnt++;
       }
     }
-    assert (tmpCnt == count) : "Intersection Count Check: got: " + tmpCnt + ", expected: " + count;
+    assert tmpCnt == count : "Intersection Count Check: got: " + tmpCnt + ", expected: " + count;
   }
 
   private void hardReset() {
diff --git a/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java b/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java
index 8abea88..4a5d337 100644
--- a/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java
+++ b/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java
@@ -54,7 +54,7 @@
    */
   public static double[] jaccard(final Sketch sketchA, final Sketch sketchB) {
     //Corner case checks
-    if ((sketchA == null) || (sketchB == null)) { return ZEROS.clone(); }
+    if (sketchA == null || sketchB == null) { return ZEROS.clone(); }
     if (sketchA == sketchB) { return ONES.clone(); }
     if (sketchA.isEmpty() && sketchB.isEmpty()) { return ONES.clone(); }
     if (sketchA.isEmpty() || sketchB.isEmpty()) { return ZEROS.clone(); }
@@ -68,8 +68,8 @@
     final int newK = max(min(ceilingPowerOf2(countA + countB), maxK), minK);
     final Union union =
         SetOperation.builder().setNominalEntries(newK).buildUnion();
-    union.update(sketchA);
-    union.update(sketchB);
+    union.union(sketchA);
+    union.union(sketchB);
     final Sketch unionAB = union.getResult(false, null);
     final long thetaLongUAB = unionAB.getThetaLong();
     final long thetaLongA = sketchA.getThetaLong();
@@ -77,8 +77,8 @@
     final int countUAB = unionAB.getRetainedEntries(true);
 
     //Check for identical data
-    if ((countUAB == countA) && (countUAB == countB)
-        && (thetaLongUAB == thetaLongA) && (thetaLongUAB == thetaLongB)) {
+    if (countUAB == countA && countUAB == countB
+        && thetaLongUAB == thetaLongA && thetaLongUAB == thetaLongB) {
       return ONES.clone();
     }
 
@@ -105,7 +105,7 @@
    */
   public static boolean exactlyEqual(final Sketch sketchA, final Sketch sketchB) {
     //Corner case checks
-    if ((sketchA == null) || (sketchB == null)) { return false; }
+    if (sketchA == null || sketchB == null) { return false; }
     if (sketchA == sketchB) { return true; }
     if (sketchA.isEmpty() && sketchB.isEmpty()) { return true; }
     if (sketchA.isEmpty() || sketchB.isEmpty()) { return false; }
@@ -116,8 +116,8 @@
     //Create the Union
     final Union union =
         SetOperation.builder().setNominalEntries(ceilingPowerOf2(countA + countB)).buildUnion();
-    union.update(sketchA);
-    union.update(sketchB);
+    union.union(sketchA);
+    union.union(sketchB);
     final Sketch unionAB = union.getResult();
     final long thetaLongUAB = unionAB.getThetaLong();
     final long thetaLongA = sketchA.getThetaLong();
@@ -125,8 +125,8 @@
     final int countUAB = unionAB.getRetainedEntries(true);
 
     //Check for identical counts and thetas
-    if ((countUAB == countA) && (countUAB == countB)
-        && (thetaLongUAB == thetaLongA) && (thetaLongUAB == thetaLongB)) {
+    if (countUAB == countA && countUAB == countB
+        && thetaLongUAB == thetaLongA && thetaLongUAB == thetaLongB) {
       return true;
     }
     return false;
diff --git a/src/main/java/org/apache/datasketches/theta/Union.java b/src/main/java/org/apache/datasketches/theta/Union.java
index 1d74a2f..1e9ea7a 100644
--- a/src/main/java/org/apache/datasketches/theta/Union.java
+++ b/src/main/java/org/apache/datasketches/theta/Union.java
@@ -36,6 +36,14 @@
   }
 
   /**
+   * Gets the result of this operation as an ordered CompactSketch on the Java heap.
+   * This does not disturb the underlying data structure of the union.
+   * Therefore, it is OK to continue updating the union after this operation.
+   * @return the result of this operation as an ordered CompactSketch on the Java heap
+   */
+  public abstract CompactSketch getResult();
+
+  /**
    * Gets the result of this operation as a CompactSketch of the chosen form.
    * This does not disturb the underlying data structure of the union.
    * Therefore, it is OK to continue updating the union after this operation.
@@ -51,14 +59,6 @@
   public abstract CompactSketch getResult(boolean dstOrdered, WritableMemory dstMem);
 
   /**
-   * Gets the result of this operation as an ordered CompactSketch on the Java heap.
-   * This does not disturb the underlying data structure of the union.
-   * Therefore, it is OK to continue updating the union after this operation.
-   * @return the result of this operation as an ordered CompactSketch on the Java heap
-   */
-  public abstract CompactSketch getResult();
-
-  /**
    * Resets this Union. The seed remains intact, otherwise reverts back to its virgin state.
    */
   public abstract void reset();
@@ -108,6 +108,20 @@
    *
    * @param sketchIn The incoming sketch.
    */
+  public abstract void union(Sketch sketchIn);
+
+
+  /**
+   * Perform a Union operation with <i>this</i> union and the given on-heap sketch of the Theta Family.
+   * This method is not valid for the older SetSketch, which was prior to Open Source (August, 2015).
+   *
+   * <p>This method can be repeatedly called.
+   * If the given sketch is null it is interpreted as an empty sketch.</p>
+   *
+   * @param sketchIn The incoming sketch.
+   * @deprecated 2.0.0.  Use {@link #union(Sketch)} instead.
+   */
+  @Deprecated
   public abstract void update(Sketch sketchIn);
 
   /**
@@ -120,6 +134,20 @@
    *
    * @param mem Memory image of sketch to be merged
    */
+  public abstract void union(Memory mem);
+
+  /**
+   * Perform a Union operation with <i>this</i> union and the given Memory image of any sketch of the
+   * Theta Family. The input image may be from earlier versions of the Theta Compact Sketch,
+   * called the SetSketch (circa 2012), which was prior to Open Source and are compact and ordered.
+   *
+   * <p>This method can be repeatedly called.
+   * If the given sketch is null it is interpreted as an empty sketch.</p>
+   *
+   * @param mem Memory image of sketch to be merged
+   * @deprecated 2.0.0. Use {@link #union(Memory)} instead.
+   */
+  @Deprecated
   public abstract void update(Memory mem);
 
   /**
diff --git a/src/main/java/org/apache/datasketches/theta/UnionImpl.java b/src/main/java/org/apache/datasketches/theta/UnionImpl.java
index 72515f6..700ee71 100644
--- a/src/main/java/org/apache/datasketches/theta/UnionImpl.java
+++ b/src/main/java/org/apache/datasketches/theta/UnionImpl.java
@@ -210,7 +210,7 @@
 
   @Override
   public boolean isSameResource(final Memory that) {
-    return (gadget_ instanceof DirectQuickSelectSketchR)
+    return gadget_ instanceof DirectQuickSelectSketchR
         ? gadget_.getMemory().isSameResource(that) : false;
   }
 
@@ -224,19 +224,19 @@
     final int gadgetCurCount = gadget_.getRetainedEntries(true);
     final int k = 1 << gadget_.getLgNomLongs();
     final long[] gadgetCacheCopy =
-        (gadget_.hasMemory()) ? gadget_.getCache() : gadget_.getCache().clone();
+        gadget_.hasMemory() ? gadget_.getCache() : gadget_.getCache().clone();
 
     //Pull back to k
     final long curGadgetThetaLong = gadget_.getThetaLong();
-    final long adjGadgetThetaLong = (gadgetCurCount > k)
+    final long adjGadgetThetaLong = gadgetCurCount > k
         ? selectExcludingZeros(gadgetCacheCopy, gadgetCurCount, k + 1) : curGadgetThetaLong;
 
     //Finalize Theta and curCount
-    final long unionThetaLong = (gadget_.hasMemory())
+    final long unionThetaLong = gadget_.hasMemory()
         ? gadget_.getMemory().getLong(UNION_THETA_LONG) : unionThetaLong_;
 
     final long minThetaLong = min(min(curGadgetThetaLong, adjGadgetThetaLong), unionThetaLong);
-    final int curCountOut = (minThetaLong < curGadgetThetaLong)
+    final int curCountOut = minThetaLong < curGadgetThetaLong
         ? HashOperations.count(gadgetCacheCopy, minThetaLong)
         : gadgetCurCount;
 
@@ -277,11 +277,17 @@
     return getResult(dstOrdered, dstMem);
   }
 
+  @Deprecated
   @Override
-  public void update(final Sketch sketchIn) { //Only valid for theta Sketches using SerVer = 3
+  public void update(final Sketch sketchIn) {
+    union(sketchIn);
+  }
+
+  @Override
+  public void union(final Sketch sketchIn) { //Only valid for theta Sketches using SerVer = 3
     //UNION Empty Rule: AND the empty states.
 
-    if ((sketchIn == null) || sketchIn.isEmpty()) {
+    if (sketchIn == null || sketchIn.isEmpty()) {
       //null and empty is interpreted as (Theta = 1.0, count = 0, empty = T).  Nothing changes
       return;
     }
@@ -303,7 +309,7 @@
           final Memory skMem = ((CompactSketch) sketchIn).getMemory();
           final int preambleLongs = skMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
           for (int i = 0; i < curCountIn; i++ ) {
-            final int offsetBytes = (preambleLongs + i) << 3;
+            final int offsetBytes = preambleLongs + i << 3;
             final long hashIn = skMem.getLong(offsetBytes);
             if (hashIn >= unionThetaLong_) { break; } // "early stop"
             gadget_.hashUpdate(hashIn); //backdoor update, hash function is bypassed
@@ -321,9 +327,9 @@
       else { //either not-ordered compact or Hash Table form. A HT may have dirty values.
         final long[] cacheIn = sketchIn.getCache(); //if off-heap this will be a copy
         final int arrLongs = cacheIn.length;
-        for (int i = 0, c = 0; (i < arrLongs) && (c < curCountIn); i++ ) {
+        for (int i = 0, c = 0; i < arrLongs && c < curCountIn; i++ ) {
           final long hashIn = cacheIn[i];
-          if ((hashIn <= 0L) || (hashIn >= unionThetaLong_)) { continue; } //rejects dirty values
+          if (hashIn <= 0L || hashIn >= unionThetaLong_) { continue; } //rejects dirty values
           gadget_.hashUpdate(hashIn); //backdoor update, hash function is bypassed
           c++; //ensures against invalid state inside the incoming sketch
         }
@@ -337,8 +343,14 @@
     }
   }
 
+  @Deprecated
   @Override
   public void update(final Memory skMem) {
+    union(skMem);
+  }
+
+  @Override
+  public void union(final Memory skMem) {
     if (skMem == null) { return; }
     final int cap = (int) skMem.getCapacity();
     if (cap < 16) { return; } //empty or garbage
@@ -346,7 +358,7 @@
     final int fam = extractFamilyID(skMem);
 
     if (serVer == 3) { //The OpenSource sketches (Aug 4, 2015) starts with serVer = 3
-      if ((fam < 1) || (fam > 3)) {
+      if (fam < 1 || fam > 3) {
         throw new SketchesArgumentException(
             "Family must be Alpha, QuickSelect, or Compact: " + Family.idToFamily(fam));
       }
@@ -407,7 +419,7 @@
     if (ordered) { //must be compact
 
       for (int i = 0; i < curCountIn; i++ ) {
-        final int offsetBytes = (preLongs + i) << 3;
+        final int offsetBytes = preLongs + i << 3;
         final long hashIn = skMem.getLong(offsetBytes);
         if (hashIn >= unionThetaLong_) { break; } // "early stop"
         gadget_.hashUpdate(hashIn); //backdoor update, hash function is bypassed
@@ -416,12 +428,12 @@
 
     else { //not-ordered, could be compact or hash-table form
       final boolean compact = (flags & COMPACT_FLAG_MASK) != 0;
-      final int size = (compact) ? curCountIn : 1 << extractLgArrLongs(skMem);
+      final int size = compact ? curCountIn : 1 << extractLgArrLongs(skMem);
 
       for (int i = 0; i < size; i++ ) {
-        final int offsetBytes = (preLongs + i) << 3;
+        final int offsetBytes = preLongs + i << 3;
         final long hashIn = skMem.getLong(offsetBytes);
-        if ((hashIn <= 0L) || (hashIn >= unionThetaLong_)) { continue; }
+        if (hashIn <= 0L || hashIn >= unionThetaLong_) { continue; }
         gadget_.hashUpdate(hashIn); //backdoor update, hash function is bypassed
       }
     }
diff --git a/src/main/java/org/apache/datasketches/theta/package-info.java b/src/main/java/org/apache/datasketches/theta/package-info.java
index 12c886f..9268109 100644
--- a/src/main/java/org/apache/datasketches/theta/package-info.java
+++ b/src/main/java/org/apache/datasketches/theta/package-info.java
@@ -18,46 +18,12 @@
  */
 
 /**
- * <p>The theta package contains all the sketch classes that are members of the 
- * <a href="{@docRoot}/resources/dictionary.html#thetaSketch">Theta Sketch Framework</a>.  
- * The basic sketching functionality in this package is also 
- * accessible from Hadoop Pig UDFs found in the <i>sketches-pig</i> repository, 
+ * <p>The theta package contains all the sketch classes that are members of the
+ * <a href="{@docRoot}/resources/dictionary.html#thetaSketch">Theta Sketch Framework</a>.
+ * The basic sketching functionality in this package is also
+ * accessible from Hadoop Pig UDFs found in the <i>sketches-pig</i> repository,
  * and from Hadoop Hive UADFs and UDFs found in the <i>sketches-hive</i> repository.
  * </p>
- * <h3>Simple Java Example</h3>
- * Note: The complete example code can be found in the parallel package under src/test/java and 
- * with the class name "ExamplesTest.java".
-<pre>
-  public void SimpleCountingSketch() {
-    int k = 4096;
-    int u = 1000000;
-    
-    UpdateSketch sketch = UpdateSketch.builder().build(k);
-    for (int i = 0; i &lt; u; i++) {
-      sketch.update(i);
-    }
-    
-    println(sketch.toString());
-  }
-
-### HeapQuickSelectSketch SUMMARY: 
-   Nominal Entries (k)     : 4096
-   Estimate                : 1002714.745231455
-   Upper Bound, 95% conf   : 1027777.3354974985
-   Lower Bound, 95% conf   : 978261.4472857157
-   p                       : 1.0
-   Theta (double)          : 0.00654223948655085
-   Theta (long)            : 60341508738660257
-   Theta (long, hex        : 00d66048519437a1
-   EstMode?                : true
-   Empty?                  : false
-   Resize Factor           : 8
-   Array Size Entries      : 8192
-   Retained Entries        : 6560
-   Update Seed             : 9001
-   Seed Hash               : ffff93cc
-### END SKETCH SUMMARY
-</pre>
  *
  * @author Lee Rhodes
  */
diff --git a/src/main/java/org/apache/datasketches/tuple/AnotB.java b/src/main/java/org/apache/datasketches/tuple/AnotB.java
index 10202be..31a83e2 100644
--- a/src/main/java/org/apache/datasketches/tuple/AnotB.java
+++ b/src/main/java/org/apache/datasketches/tuple/AnotB.java
@@ -199,7 +199,7 @@
    *
    * @param reset If <i>true</i>, clears this operator to the empty state after this result is
    * returned. Set this to <i>false</i> if you wish to obtain an intermediate result.
-   * @return the result of this operation as a {@link CompactSketch}.
+   * @return the result of this operation as an unordered {@link CompactSketch}.
    */
   public CompactSketch<S> getResult(final boolean reset) {
     if (curCount_ == 0) {
@@ -233,7 +233,7 @@
    * @param skA The incoming Tuple sketch for the first argument
    * @param skB The incoming Tuple sketch for the second argument
    * @param <S> Type of Summary
-   * @return the result as a compact sketch
+   * @return the result as an unordered {@link CompactSketch}
    */
   public static <S extends Summary>
         CompactSketch<S> aNotB(final Sketch<S> skA, final Sketch<S> skB) {
@@ -285,7 +285,7 @@
    * @param skA The incoming Tuple sketch for the first argument
    * @param skB The incoming Theta sketch for the second argument
    * @param <S> Type of Summary
-   * @return the result as a compact sketch
+   * @return the result as an unordered {@link CompactSketch}
    */
   public static <S extends Summary>
         CompactSketch<S> aNotB(final Sketch<S> skA, final org.apache.datasketches.theta.Sketch skB) {
@@ -470,7 +470,7 @@
   /**
    * Gets the result of this operation. This clears the state of this operator after the result is
    * returned.
-   * @return the result of this operation as a CompactSketch
+   * @return the result of this operation as an unordered {@link CompactSketch}
    * @deprecated v2.0.0. Instead use {@link #getResult(boolean)}.
    */
   @Deprecated
diff --git a/src/main/java/org/apache/datasketches/tuple/Intersection.java b/src/main/java/org/apache/datasketches/tuple/Intersection.java
index c10cad7..d92f203 100644
--- a/src/main/java/org/apache/datasketches/tuple/Intersection.java
+++ b/src/main/java/org/apache/datasketches/tuple/Intersection.java
@@ -47,11 +47,12 @@
   private final SummarySetOperations<S> summarySetOps_;
   private boolean empty_;
   private long thetaLong_;
-  private HashTables hashTables_;
+  private final HashTables hashTables_;
   private boolean firstCall_;
 
   /**
-   * Creates new instance
+   * Creates new Intersection instance with instructions on how to process two summaries that
+   * intersect.
    * @param summarySetOps instance of SummarySetOperations
    */
   public Intersection(final SummarySetOperations<S> summarySetOps) {
@@ -76,7 +77,7 @@
     final int countIn = sketchIn.getRetainedEntries();
     thetaLong_ = min(thetaLong_, thetaLongIn); //Theta rule
     // Empty rule extended in case incoming sketch does not have empty bit properly set
-    empty_ |= (countIn == 0) && (thetaLongIn == Long.MAX_VALUE);
+    empty_ |= countIn == 0 && thetaLongIn == Long.MAX_VALUE;
     if (countIn == 0) {
       hashTables_.clear();
       return;
@@ -128,7 +129,7 @@
    * Updates the internal set by intersecting it with the given Theta sketch.
    * @param sketchIn input Theta Sketch to intersect with the internal state. It may not be null.
    * @param summary the given proxy summary for the Theta Sketch, which doesn't have one.
-   * It may not be null.
+   * It will be copied for each matching index. It may not be null.
    */
   public void update(final org.apache.datasketches.theta.Sketch sketchIn, final S summary) {
     if (sketchIn == null) { throw new SketchesArgumentException("Sketch may not be null"); }
@@ -140,7 +141,7 @@
     final int countIn = sketchIn.getRetainedEntries(true);
     thetaLong_ = min(thetaLong_, thetaLongIn); //Theta rule
     // Empty rule extended in case incoming sketch does not have empty bit properly set
-    empty_ |= (countIn == 0) && (thetaLongIn == Long.MAX_VALUE);
+    empty_ |= countIn == 0 && thetaLongIn == Long.MAX_VALUE;
     if (countIn == 0) {
       hashTables_.clear();
       return;
@@ -180,7 +181,7 @@
           matchSummaries = (S[]) Array.newInstance(summaryType, maxMatchSize);
         }
         matchHashArr[matchCount] = hash;
-        matchSummaries[matchCount] = summarySetOps_.intersection(mySummary, (S)mySummary.copy());
+        matchSummaries[matchCount] = summarySetOps_.intersection(mySummary, (S)summary.copy());
         matchCount++;
       }
       hashTables_.fromArrays(matchHashArr, matchSummaries, matchCount);
@@ -188,7 +189,7 @@
   }
 
   /**
-   * Gets the internal set as a CompactSketch
+   * Gets the internal set as an unordered CompactSketch
    * @return result of the intersections so far
    */
   public CompactSketch<S> getResult() {
@@ -207,7 +208,7 @@
     int cnt = 0;
     for (int i = 0; i < tableSize; i++) {
       final long hash = hashTables_.hashTable_[i];
-      if ((hash == 0) || (hash > thetaLong_)) { continue; }
+      if (hash == 0 || hash > thetaLong_) { continue; }
       final S summary = hashTables_.summaryTable_[i];
       if (summaries == null) {
         summaries = (S[]) Array.newInstance(summaryType, hashTables_.count_);
diff --git a/src/main/java/org/apache/datasketches/tuple/Union.java b/src/main/java/org/apache/datasketches/tuple/Union.java
index 884faff..5debba6 100644
--- a/src/main/java/org/apache/datasketches/tuple/Union.java
+++ b/src/main/java/org/apache/datasketches/tuple/Union.java
@@ -41,7 +41,8 @@
   private boolean empty_;
 
   /**
-   * Creates new instance with default nominal entries
+   * Creates new Intersection instance with instructions on how to process two summaries that
+   * overlap. This will have the default nominal entries (K).
    * @param summarySetOps instance of SummarySetOperations
    */
   public Union(final SummarySetOperations<S> summarySetOps) {
@@ -49,8 +50,10 @@
   }
 
   /**
+   * Creates new Intersection instance with instructions on how to process two summaries that
+   * overlap.
    * Creates new instance
-   * @param nomEntries nominal number of entries. Forced to the nearest power of 2 greater than
+   * @param nomEntries nominal entries (K). Forced to the nearest power of 2 greater than
    * given value.
    * @param summarySetOps instance of SummarySetOperations
    */
@@ -67,7 +70,7 @@
    * If null or empty, it is ignored.
    */
   public void update(final Sketch<S> sketchIn) {
-    if ((sketchIn == null) || sketchIn.isEmpty()) { return; }
+    if (sketchIn == null || sketchIn.isEmpty()) { return; }
     empty_ = false;
     if (sketchIn.thetaLong_ < thetaLong_) { thetaLong_ = sketchIn.thetaLong_; }
     final SketchIterator<S> it = sketchIn.iterator();
@@ -91,7 +94,7 @@
   public void update(final org.apache.datasketches.theta.Sketch sketchIn, final S summary) {
     if (summary == null) {
       throw new SketchesArgumentException("Summary cannot be null."); }
-    if ((sketchIn == null) || sketchIn.isEmpty()) { return; }
+    if (sketchIn == null || sketchIn.isEmpty()) { return; }
     empty_ = false;
     final long thetaIn = sketchIn.getThetaLong();
     if (thetaIn < thetaLong_) { thetaLong_ = thetaIn; }
@@ -105,7 +108,7 @@
   }
 
   /**
-   * Gets the internal set as a CompactSketch
+   * Gets the internal set as an unordered CompactSketch
    * @return result of the unions so far
    */
   @SuppressWarnings("unchecked")
@@ -113,7 +116,7 @@
     if (empty_) {
       return qsk_.compact();
     }
-    if ((thetaLong_ >= qsk_.thetaLong_) && (qsk_.getRetainedEntries() <= qsk_.getNominalEntries())) {
+    if (thetaLong_ >= qsk_.thetaLong_ && qsk_.getRetainedEntries() <= qsk_.getNominalEntries()) {
       return qsk_.compact();
     }
     long theta = min(thetaLong_, qsk_.thetaLong_);
diff --git a/src/main/java/org/apache/datasketches/tuple/UpdatableSummary.java b/src/main/java/org/apache/datasketches/tuple/UpdatableSummary.java
index ac5ce93..4ddb71d 100644
--- a/src/main/java/org/apache/datasketches/tuple/UpdatableSummary.java
+++ b/src/main/java/org/apache/datasketches/tuple/UpdatableSummary.java
@@ -27,9 +27,10 @@
 
   /**
    * This is to provide a method of updating summaries.
-   * This should not be called by the user.
+   * This is primarily used internally.
    * @param value update value
+   * @return this
    */
-  public void update(U value);
+  UpdatableSummary<U> update(U value);
 
 }
diff --git a/src/main/java/org/apache/datasketches/tuple/adouble/DoubleSummary.java b/src/main/java/org/apache/datasketches/tuple/adouble/DoubleSummary.java
index ae6b7c0..76c1633 100644
--- a/src/main/java/org/apache/datasketches/tuple/adouble/DoubleSummary.java
+++ b/src/main/java/org/apache/datasketches/tuple/adouble/DoubleSummary.java
@@ -37,7 +37,7 @@
   /**
    * The aggregation modes for this Summary
    */
-  public static enum Mode {
+  public enum Mode {
 
     /**
      * The aggregation mode is the summation function.
@@ -97,10 +97,10 @@
   }
 
   @Override
-  public void update(final Double value) {
+  public DoubleSummary update(final Double value) {
     switch (mode_) {
     case Sum:
-      value_ += value.doubleValue();
+      value_ += value;
       break;
     case Min:
       if (value < value_) { value_ = value; }
@@ -112,6 +112,7 @@
       value_ = 1.0;
       break;
     }
+    return this;
   }
 
   @Override
diff --git a/src/main/java/org/apache/datasketches/tuple/aninteger/IntegerSummary.java b/src/main/java/org/apache/datasketches/tuple/aninteger/IntegerSummary.java
index a0e3e29..3af888b 100644
--- a/src/main/java/org/apache/datasketches/tuple/aninteger/IntegerSummary.java
+++ b/src/main/java/org/apache/datasketches/tuple/aninteger/IntegerSummary.java
@@ -37,7 +37,7 @@
   /**
    * The aggregation modes for this Summary
    */
-  public static enum Mode {
+  public enum Mode {
 
     /**
      * The aggregation mode is the summation function.
@@ -96,13 +96,8 @@
     }
   }
 
-  /**
-   * Updates an instance of IntegerSummary with the given value.
-   * This should not be called by the user.
-   * @param value The given value.
-   */
   @Override
-  public void update(final Integer value) {
+  public IntegerSummary update(final Integer value) {
     switch (mode_) {
     case Sum:
       value_ += value;
@@ -117,6 +112,7 @@
       value_ = 1;
       break;
     }
+    return this;
   }
 
   @Override
diff --git a/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java b/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java
index 48cfbc6..75ab751 100644
--- a/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java
+++ b/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java
@@ -90,11 +90,11 @@
   //From UpdatableSummary
 
   @Override
-  public void update(final String[] value) {
+  public ArrayOfStringsSummary update(final String[] value) {
     if (nodesArr == null) {
       nodesArr = value.clone();
     }
-    //otherwise do not update.
+    return this;
   }
 
   //From Object
@@ -106,7 +106,7 @@
 
   @Override
   public boolean equals(final Object summary) {
-    if ((summary == null) || !(summary instanceof ArrayOfStringsSummary)) {
+    if (summary == null || !(summary instanceof ArrayOfStringsSummary)) {
       return false;
     }
     final String thatStr = stringConcat(((ArrayOfStringsSummary) summary).nodesArr);
@@ -152,7 +152,7 @@
         nodeLengthsArr_[i] = nodeBytesArr_[i].length;
         sumNodeBytes += nodeLengthsArr_[i];
       }
-      totBytes_ = sumNodeBytes + ((numNodes_ + 1) * Integer.BYTES) + 1;
+      totBytes_ = sumNodeBytes + (numNodes_ + 1) * Integer.BYTES + 1;
     }
   }
 
diff --git a/src/test/java/org/apache/datasketches/theta/DirectUnionTest.java b/src/test/java/org/apache/datasketches/theta/DirectUnionTest.java
index eb372a0..d92e672 100644
--- a/src/test/java/org/apache/datasketches/theta/DirectUnionTest.java
+++ b/src/test/java/org/apache/datasketches/theta/DirectUnionTest.java
@@ -46,14 +46,14 @@
 
   @Test
   public void checkExactUnionNoOverlap() {
-    int lgK = 9; //512
-    int k = 1 << lgK;
-    int u = k;
+    final int lgK = 9; //512
+    final int k = 1 << lgK;
+    final int u = k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //256
     }
     for (int i=u/2; i<u; i++) {
@@ -62,77 +62,77 @@
 
     assertEquals(u, usk1.getEstimate() + usk2.getEstimate(), 0.0); //exact, no overlap
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.0);
   }
 
   @Test
   public void checkEstUnionNoOverlap() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //2*k
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i); //2*k no overlap
     }
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.05);
   }
 
   @Test
   public void checkExactUnionWithOverlap() {
-    int lgK = 9; //512
-    int k = 1 << lgK;
-    int u = k;
+    final int lgK = 9; //512
+    final int k = 1 << lgK;
+    final int u = k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //256
     }
     for (int i=0; i<u  ; i++) {
       usk2.update(i); //512, 256 overlapped
     }
 
-    assertEquals(u, usk1.getEstimate() + (usk2.getEstimate()/2), 0.0); //exact, overlapped
+    assertEquals(u, usk1.getEstimate() + usk2.getEstimate()/2, 0.0); //exact, overlapped
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.0);
   }
 
   @Test
   public void checkHeapifyExact() {
-    int lgK = 9; //512
-    int k = 1 << lgK;
-    int u = k;
+    final int lgK = 9; //512
+    final int k = 1 << lgK;
+    final int u = k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //256
     }
     for (int i=u/2; i<u; i++) {
@@ -141,15 +141,15 @@
 
     assertEquals(u, usk1.getEstimate() + usk2.getEstimate(), 0.0); //exact, no overlap
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.0);
 
-    Union union2 = (Union)SetOperation.heapify(WritableMemory.wrap(union.toByteArray()));
+    final Union union2 = (Union)SetOperation.heapify(WritableMemory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.0);
   }
@@ -157,14 +157,14 @@
   //these parallel the checkHeapifyExact, etc.
   @Test
   public void checkWrapExact() {
-    int lgK = 9; //512
-    int k = 1 << lgK;
-    int u = k;
+    final int lgK = 9; //512
+    final int k = 1 << lgK;
+    final int u = k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //256
     }
     for (int i=u/2; i<u; i++) {
@@ -173,80 +173,80 @@
 
     assertEquals(u, usk1.getEstimate() + usk2.getEstimate(), 0.0); //exact, no overlap
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.0);
 
-    Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
+    final Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.0);
   }
 
   @Test
   public void checkWrapEstNoOverlap() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //2k
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i); //2k no overlap, exact
     }
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch, early stop not possible
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch, early stop not possible
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
+    final Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
   }
 
   @Test
   public void checkWrapEstNoOverlapOrderedIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //2k estimating
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i); //2k no overlap, exact, will force early stop
     }
 
-    CompactSketch cosk2 = usk2.compact(true, null);
+    final CompactSketch cosk2 = usk2.compact(true, null);
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1);  //update with heap UpdateSketch
-    union.update(cosk2); //update with heap Compact, Ordered input, early stop
+    union.union(usk1);  //update with heap UpdateSketch
+    union.union(cosk2); //update with heap Compact, Ordered input, early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty
+    union.union(emptySketch); //updates with empty
     emptySketch = null;
-    union.update(emptySketch); //updates with null
+    union.union(emptySketch); //updates with null
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
+    final Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -256,37 +256,37 @@
 
   @Test
   public void checkWrapEstNoOverlapOrderedDirectIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build(); //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build(); //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //2k estimating
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i);  //2k no overlap, exact, will force early stop
     }
 
-    WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
-    CompactSketch cosk2 = usk2.compact(true, cskMem2); //ordered, loads the cskMem2 as ordered
+    final WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
+    final CompactSketch cosk2 = usk2.compact(true, cskMem2); //ordered, loads the cskMem2 as ordered
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1);      //updates with heap UpdateSketch
-    union.update(cosk2);     //updates with direct CompactSketch, ordered, use early stop
+    union.union(usk1);      //updates with heap UpdateSketch
+    union.union(cosk2);     //updates with direct CompactSketch, ordered, use early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty sketch
+    union.union(emptySketch); //updates with empty sketch
     emptySketch = null;
-    union.update(emptySketch); //updates with null sketch
+    union.union(emptySketch); //updates with null sketch
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
+    final Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -296,37 +296,37 @@
 
   @Test
   public void checkWrapEstNoOverlapOrderedMemIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i);  //2k estimating
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i);  //2k no overlap, exact, will force early stop
     }
 
-    WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
+    final WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
     usk2.compact(true, cskMem2); //ordered, loads the cskMem2 as ordered
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1);        //updates with heap UpdateSketch
-    union.update(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
+    union.union(usk1);        //updates with heap UpdateSketch
+    union.union(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty sketch
+    union.union(emptySketch); //updates with empty sketch
     emptySketch = null;
-    union.update(emptySketch); //updates with null sketch
+    union.union(emptySketch); //updates with null sketch
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
+    final Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -336,37 +336,37 @@
 
   @Test
   public void checkWrapEstNoOverlapUnorderedMemIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i);  //2k estimating
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i);  //2k no overlap, exact, will force early stop
     }
 
-    WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
+    final WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
     usk2.compact(false, cskMem2); //unordered, loads the cskMem2 as unordered
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1);        //updates with heap UpdateSketch
-    union.update(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
+    union.union(usk1);        //updates with heap UpdateSketch
+    union.union(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty sketch
+    union.union(emptySketch); //updates with empty sketch
     emptySketch = null;
-    union.update(emptySketch); //updates with null sketch
+    union.union(emptySketch); //updates with null sketch
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
+    final Union union2 = Sketches.wrapUnion(WritableMemory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -376,13 +376,13 @@
 
   @Test
   public void checkMultiUnion() {
-    int lgK = 13; //8192
-    int k = 1 << lgK;
+    final int lgK = 13; //8192
+    final int k = 1 << lgK;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk3 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk4 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk3 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk4 = UpdateSketch.builder().setNominalEntries(k).build();
 
     int v=0;
     int u = 1000000;
@@ -404,29 +404,29 @@
     }
     v += u;
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(usk1); //updates with heap UpdateSketch
-    union.update(usk2); //updates with heap UpdateSketch
-    union.update(usk3); //updates with heap UpdateSketch
-    union.update(usk4); //updates with heap UpdateSketch
+    union.union(usk1); //updates with heap UpdateSketch
+    union.union(usk2); //updates with heap UpdateSketch
+    union.union(usk3); //updates with heap UpdateSketch
+    union.union(usk4); //updates with heap UpdateSketch
 
-    CompactSketch csk = union.getResult(true, null);
-    double est = csk.getEstimate();
+    final CompactSketch csk = union.getResult(true, null);
+    final double est = csk.getEstimate();
     assertEquals(est, v, .01*v);
   }
 
   @Test
   public void checkDirectMemoryIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u1 = 2*k;
-    int u2 = 1024; //smaller exact sketch forces early stop
-    int totU = u1+u2;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u1 = 2*k;
+    final int u2 = 1024; //smaller exact sketch forces early stop
+    final int totU = u1+u2;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
     for (int i=0; i<u1; i++) {
       usk1.update(i); //2*k
@@ -435,32 +435,32 @@
       usk2.update(i); //2*k + 1024 no overlap
     }
 
-    Memory skMem1 = Memory.wrap(usk1.compact(false, null).toByteArray());
-    Memory skMem2 = Memory.wrap(usk2.compact(true, null).toByteArray());
+    final Memory skMem1 = Memory.wrap(usk1.compact(false, null).toByteArray());
+    final Memory skMem2 = Memory.wrap(usk2.compact(true, null).toByteArray());
 
-    CompactSketch csk1 = (CompactSketch)Sketch.wrap(skMem1);
-    CompactSketch csk2 = (CompactSketch)Sketch.wrap(skMem2);
+    final CompactSketch csk1 = (CompactSketch)Sketch.wrap(skMem1);
+    final CompactSketch csk2 = (CompactSketch)Sketch.wrap(skMem2);
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(csk1);
-    union.update(csk2);
+    union.union(csk1);
+    union.union(csk2);
 
-    CompactSketch cOut = union.getResult(true, null);
+    final CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), totU, .05*k);
   }
 
   @Test
   public void checkSerVer1Handling() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u1 = 2*k;
-    int u2 = 1024; //smaller exact sketch forces early stop
-    int totU = u1+u2;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u1 = 2*k;
+    final int u2 = 1024; //smaller exact sketch forces early stop
+    final int totU = u1+u2;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
     for (int i=0; i<u1; i++) {
       usk1.update(i); //2*k
@@ -469,29 +469,29 @@
       usk2.update(i); //2*k + 1024 no overlap
     }
 
-    Memory v1mem1 = convertSerVer3toSerVer1(usk1.compact(true, null));
-    Memory v1mem2 = convertSerVer3toSerVer1(usk2.compact(true, null));
+    final Memory v1mem1 = convertSerVer3toSerVer1(usk1.compact(true, null));
+    final Memory v1mem2 = convertSerVer3toSerVer1(usk2.compact(true, null));
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(v1mem1);
-    union.update(v1mem2);
+    union.union(v1mem1);
+    union.union(v1mem2);
 
-    CompactSketch cOut = union.getResult(true, null);
+    final CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), totU, .05*k);
   }
 
   @Test
   public void checkSerVer2Handling() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u1 = 2*k;
-    int u2 = 1024; //smaller exact sketch forces early stop
-    int totU = u1+u2;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u1 = 2*k;
+    final int u2 = 1024; //smaller exact sketch forces early stop
+    final int totU = u1+u2;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
     for (int i=0; i<u1; i++) {
       usk1.update(i); //2*k
@@ -500,196 +500,196 @@
       usk2.update(i); //2*k + 1024 no overlap
     }
 
-    Memory v2mem1 = convertSerVer3toSerVer2(usk1.compact(true, null), Util.DEFAULT_UPDATE_SEED);
-    Memory v2mem2 = convertSerVer3toSerVer2(usk2.compact(true, null), Util.DEFAULT_UPDATE_SEED);
+    final Memory v2mem1 = convertSerVer3toSerVer2(usk1.compact(true, null), Util.DEFAULT_UPDATE_SEED);
+    final Memory v2mem2 = convertSerVer3toSerVer2(usk2.compact(true, null), Util.DEFAULT_UPDATE_SEED);
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(v2mem1);
-    union.update(v2mem2);
+    union.union(v2mem1);
+    union.union(v2mem2);
 
-    CompactSketch cOut = union.getResult(true, null);
+    final CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), totU, .05*k);
   }
 
   @Test
   public void checkUpdateMemorySpecialCases() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    CompactSketch usk1c = usk1.compact(true, null);
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final CompactSketch usk1c = usk1.compact(true, null);
     WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
 
-    Memory v1mem1 = convertSerVer3toSerVer1(usk1c);
+    final Memory v1mem1 = convertSerVer3toSerVer1(usk1c);
 
     WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
     Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
-    union.update(v1mem1);
+    union.union(v1mem1);
     CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
 
-    Memory v2mem1 = convertSerVer3toSerVer2(usk1c, Util.DEFAULT_UPDATE_SEED);
+    final Memory v2mem1 = convertSerVer3toSerVer2(usk1c, Util.DEFAULT_UPDATE_SEED);
 
     uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
     union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
-    union.update(v2mem1);
+    union.union(v2mem1);
     cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
 
     uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
     union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
-    union.update(v3mem1);
+    union.union(v3mem1);
     cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
 
     uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
     union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
     v3mem1 = null;
-    union.update(v3mem1);
+    union.union(v3mem1);
     cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
   }
 
   @Test
   public void checkUpdateMemorySpecialCases2() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 2*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 2*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i=0; i<u; i++)
      {
       usk1.update(i); //force prelongs to 3
     }
-    CompactSketch usk1c = usk1.compact(true, null);
-    WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
+    final CompactSketch usk1c = usk1.compact(true, null);
+    final WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
-    union.update(v3mem1);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    union.union(v3mem1);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkMemBadSerVer() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     usk1.update(1);
     usk1.update(2);
-    CompactSketch usk1c = usk1.compact(true, null);
-    WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
+    final CompactSketch usk1c = usk1.compact(true, null);
+    final WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
     //corrupt SerVer
     v3mem1.putByte(SER_VER_BYTE, (byte)0);
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    union.update(v3mem1);
+    union.union(v3mem1);
   }
 
   @Test
   public void checkEmptySerVer2and3() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    CompactSketch usk1c = usk1.compact(true, null);
-    byte[] skArr = usk1c.toByteArray();
-    byte[] skArr2 = Arrays.copyOf(skArr, skArr.length * 2);
-    WritableMemory v3mem1 = WritableMemory.wrap(skArr2);
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final CompactSketch usk1c = usk1.compact(true, null);
+    final byte[] skArr = usk1c.toByteArray();
+    final byte[] skArr2 = Arrays.copyOf(skArr, skArr.length * 2);
+    final WritableMemory v3mem1 = WritableMemory.wrap(skArr2);
 
     WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
     Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
-    union.update(v3mem1);
+    union.union(v3mem1);
 
-    Memory v2mem1 = convertSerVer3toSerVer2(usk1c, Util.DEFAULT_UPDATE_SEED);
-    WritableMemory v2mem2 = WritableMemory.wrap(new byte[16]);
+    final Memory v2mem1 = convertSerVer3toSerVer2(usk1c, Util.DEFAULT_UPDATE_SEED);
+    final WritableMemory v2mem2 = WritableMemory.wrap(new byte[16]);
     v2mem1.copyTo(0, v2mem2, 0, 8);
 
     uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
     union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
-    union.update(v2mem2);
+    union.union(v2mem2);
   }
 
   //Special DirectUnion cases
   @Test //Himanshu's issue
   public void checkDirectWrap() {
-    int nomEntries = 16;
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(nomEntries)]);
+    final int nomEntries = 16;
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(nomEntries)]);
     SetOperation.builder().setNominalEntries(nomEntries).buildUnion(uMem);
 
-    UpdateSketch sk1 = UpdateSketch.builder().setNominalEntries(nomEntries).build();
+    final UpdateSketch sk1 = UpdateSketch.builder().setNominalEntries(nomEntries).build();
     sk1.update("a");
     sk1.update("b");
 
-    UpdateSketch sk2 = UpdateSketch.builder().setNominalEntries(nomEntries).build();
+    final UpdateSketch sk2 = UpdateSketch.builder().setNominalEntries(nomEntries).build();
     sk2.update("c");
     sk2.update("d");
 
     Union union = Sketches.wrapUnion(uMem);
-    union.update(sk1);
+    union.union(sk1);
 
     union = Sketches.wrapUnion(uMem);
-    union.update(sk2);
+    union.union(sk2);
 
-    CompactSketch sketch = union.getResult(true, null);
+    final CompactSketch sketch = union.getResult(true, null);
     assertEquals(4.0, sketch.getEstimate(), 0.0);
   }
 
   @Test
   public void checkEmptyUnionCompactResult() {
-    int k = 64;
+    final int k = 64;
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    WritableMemory mem = WritableMemory.wrap(new byte[Sketch.getMaxCompactSketchBytes(0)]);
-    CompactSketch csk = union.getResult(false, mem); //DirectCompactSketch
+    final WritableMemory mem = WritableMemory.wrap(new byte[Sketch.getMaxCompactSketchBytes(0)]);
+    final CompactSketch csk = union.getResult(false, mem); //DirectCompactSketch
     assertTrue(csk.isEmpty());
   }
 
   @Test
   public void checkEmptyUnionCompactOrderedResult() {
-    int k = 64;
+    final int k = 64;
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
-    WritableMemory mem = WritableMemory.wrap(new byte[Sketch.getMaxCompactSketchBytes(0)]);
-    CompactSketch csk = union.getResult(true, mem); //DirectCompactSketch
+    final WritableMemory mem = WritableMemory.wrap(new byte[Sketch.getMaxCompactSketchBytes(0)]);
+    final CompactSketch csk = union.getResult(true, mem); //DirectCompactSketch
     assertTrue(csk.isEmpty());
   }
 
   @Test
   public void checkUnionMemToString() {
-    int k = 64;
+    final int k = 64;
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]); //union memory
     SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
   }
 
   @Test
   public void checkGetResult() {
-    int k = 1024;
-    UpdateSketch sk = Sketches.updateSketchBuilder().build();
+    final int k = 1024;
+    final UpdateSketch sk = Sketches.updateSketchBuilder().build();
 
-    int memBytes = getMaxUnionBytes(k);
-    byte[] memArr = new byte[memBytes];
-    WritableMemory iMem = WritableMemory.wrap(memArr);
+    final int memBytes = getMaxUnionBytes(k);
+    final byte[] memArr = new byte[memBytes];
+    final WritableMemory iMem = WritableMemory.wrap(memArr);
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion(iMem);
-    union.update(sk);
-    CompactSketch csk = union.getResult();
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion(iMem);
+    union.union(sk);
+    final CompactSketch csk = union.getResult();
     assertEquals(csk.getCompactBytes(), 8);
   }
 
   @Test
   public void checkPrimitiveUpdates() {
-    int k = 32;
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    final int k = 32;
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
 
     union.update(1L);
     union.update(1.5); //#1 double
@@ -711,38 +711,38 @@
     union.update(intArr); //null int[]
     intArr = new int[0];
     union.update(intArr); //empty int[]
-    int[] intArr2 = { 1, 2, 3, 4, 5 };
+    final int[] intArr2 = { 1, 2, 3, 4, 5 };
     union.update(intArr2); //#4 actual int[]
     long[] longArr = null;
     union.update(longArr); //null long[]
     longArr = new long[0];
     union.update(longArr); //empty long[]
-    long[] longArr2 = { 6, 7, 8, 9 };
+    final long[] longArr2 = { 6, 7, 8, 9 };
     union.update(longArr2); //#5 actual long[]
-    CompactSketch comp = union.getResult();
-    double est = comp.getEstimate();
-    boolean empty = comp.isEmpty();
+    final CompactSketch comp = union.getResult();
+    final double est = comp.getEstimate();
+    final boolean empty = comp.isEmpty();
     assertEquals(est, 7.0, 0.0);
     assertFalse(empty);
   }
 
   @Test
   public void checkGetFamily() {
-    int k = 16;
-    WritableMemory mem = WritableMemory.wrap(new byte[(k*16) +32]);
-    SetOperation setOp = new SetOperationBuilder().setNominalEntries(k).build(Family.UNION, mem);
+    final int k = 16;
+    final WritableMemory mem = WritableMemory.wrap(new byte[k*16 +32]);
+    final SetOperation setOp = new SetOperationBuilder().setNominalEntries(k).build(Family.UNION, mem);
     assertEquals(setOp.getFamily(), Family.UNION);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkPreambleLongsCorruption() {
-    int k = 16;
-    WritableMemory mem = WritableMemory.wrap(new byte[(k*16) +32]);
+    final int k = 16;
+    final WritableMemory mem = WritableMemory.wrap(new byte[k*16 +32]);
 
-    SetOperation setOp = new SetOperationBuilder().setNominalEntries(k).build(Family.UNION, mem);
+    final SetOperation setOp = new SetOperationBuilder().setNominalEntries(k).build(Family.UNION, mem);
     println(setOp.toString());
-    int familyID = PreambleUtil.extractFamilyID(mem);
-    int preLongs = PreambleUtil.extractPreLongs(mem);
+    final int familyID = PreambleUtil.extractFamilyID(mem);
+    final int preLongs = PreambleUtil.extractPreLongs(mem);
     assertEquals(familyID, Family.UNION.getID());
     assertEquals(preLongs, Family.UNION.getMaxPreLongs());
     PreambleUtil.insertPreLongs(mem, 3); //Corrupt with 3; correct value is 4
@@ -751,11 +751,11 @@
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkSizeTooSmall() {
-    int k = 16;
-    WritableMemory mem = WritableMemory.wrap(new byte[(k*16) +32]); //initialized
-    SetOperation setOp = new SetOperationBuilder().setNominalEntries(k).build(Family.UNION, mem);
+    final int k = 16;
+    final WritableMemory mem = WritableMemory.wrap(new byte[k*16 +32]); //initialized
+    final SetOperation setOp = new SetOperationBuilder().setNominalEntries(k).build(Family.UNION, mem);
     println(setOp.toString());
-    WritableMemory mem2 = WritableMemory.wrap(new byte[32]); //for just preamble
+    final WritableMemory mem2 = WritableMemory.wrap(new byte[32]); //for just preamble
     mem.copyTo(0, mem2, 0, 32); //too small
     DirectQuickSelectSketch.writableWrap(mem2, Util.DEFAULT_UPDATE_SEED);
   }
@@ -773,11 +773,11 @@
 
     //create empty target union in off-heap mem
     final WritableMemory mem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union1 = SetOperation.builder().setNominalEntries(k).buildUnion(mem);
+    final Union union1 = SetOperation.builder().setNominalEntries(k).buildUnion(mem);
 
-    union1.update(s);
+    union1.union(s);
 
-    CompactSketch csk = union1.getResult();
+    final CompactSketch csk = union1.getResult();
 
     assertTrue(csk.getTheta() < 0.2);
     assertEquals(csk.getRetainedEntries(true), 16384);
@@ -799,11 +799,11 @@
 
     //create empty target union in off-heap mem
     final WritableMemory mem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union1 = SetOperation.builder().setNominalEntries(k).buildUnion(mem);
+    final Union union1 = SetOperation.builder().setNominalEntries(k).buildUnion(mem);
 
-    union1.update(memIn);
+    union1.union(memIn);
 
-    CompactSketch csk = union1.getResult();
+    final CompactSketch csk = union1.getResult();
 
     assertTrue(csk.getTheta() < 0.2);
     assertEquals(csk.getRetainedEntries(true), 16384);
@@ -820,7 +820,7 @@
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //Disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/theta/EmptyTest.java b/src/test/java/org/apache/datasketches/theta/EmptyTest.java
index 4284c2b..56a6929 100644
--- a/src/test/java/org/apache/datasketches/theta/EmptyTest.java
+++ b/src/test/java/org/apache/datasketches/theta/EmptyTest.java
@@ -41,11 +41,11 @@
 
   @Test
   public void checkEmpty() {
-    UpdateSketch sk1 = Sketches.updateSketchBuilder().build();
-    UpdateSketch sk2 = Sketches.updateSketchBuilder().build();
-    Intersection inter = Sketches.setOperationBuilder().buildIntersection();
+    final UpdateSketch sk1 = Sketches.updateSketchBuilder().build();
+    final UpdateSketch sk2 = Sketches.updateSketchBuilder().build();
+    final Intersection inter = Sketches.setOperationBuilder().buildIntersection();
 
-    int u = 100;
+    final int u = 100;
     for (int i = 0; i < u; i++) { //disjoint
       sk1.update(i);
       sk2.update(i + u);
@@ -53,24 +53,24 @@
     inter.intersect(sk1);
     inter.intersect(sk2);
 
-    CompactSketch csk = inter.getResult();
+    final CompactSketch csk = inter.getResult();
     //The intersection of two disjoint, exact-mode sketches is empty, T == 1.0.
     println(csk.toString());
     assertTrue(csk.isEmpty());
 
-    AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
-    CompactSketch csk2 = aNotB.aNotB(csk, sk1);
+    final AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
+    final CompactSketch csk2 = aNotB.aNotB(csk, sk1);
     //The AnotB of an empty, T == 1.0 sketch with another exact-mode sketch is empty, T == 1.0
     assertTrue(csk2.isEmpty());
   }
 
   @Test
   public void checkNotEmpty() {
-    UpdateSketch sk1 = Sketches.updateSketchBuilder().build();
-    UpdateSketch sk2 = Sketches.updateSketchBuilder().build();
-    Intersection inter = Sketches.setOperationBuilder().buildIntersection();
+    final UpdateSketch sk1 = Sketches.updateSketchBuilder().build();
+    final UpdateSketch sk2 = Sketches.updateSketchBuilder().build();
+    final Intersection inter = Sketches.setOperationBuilder().buildIntersection();
 
-    int u = 10000; //estimating
+    final int u = 10000; //estimating
     for (int i = 0; i < u; i++) { //disjoint
       sk1.update(i);
       sk2.update(i + u);
@@ -78,20 +78,20 @@
     inter.intersect(sk1);
     inter.intersect(sk2);
 
-    CompactSketch csk = inter.getResult();
+    final CompactSketch csk = inter.getResult();
     println(csk.toString());
     //The intersection of two disjoint, est-mode sketches is not-empty, T < 1.0.
     assertFalse(csk.isEmpty());
 
     AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
-    CompactSketch csk2 = aNotB.aNotB(csk, sk1); //empty, T < 1.0; with est-mode sketch
+    final CompactSketch csk2 = aNotB.aNotB(csk, sk1); //empty, T < 1.0; with est-mode sketch
     println(csk2.toString());
     //The AnotB of an empty, T < 1.0 sketch with another exact-mode sketch is not-empty.
     assertFalse(csk2.isEmpty());
 
-    UpdateSketch sk3 = Sketches.updateSketchBuilder().build();
+    final UpdateSketch sk3 = Sketches.updateSketchBuilder().build();
     aNotB = Sketches.setOperationBuilder().buildANotB();
-    CompactSketch csk3 = aNotB.aNotB(sk3, sk1); //empty, T == 1.0; with est-mode sketch
+    final CompactSketch csk3 = aNotB.aNotB(sk3, sk1); //empty, T == 1.0; with est-mode sketch
     println(csk3.toString());
     //the AnotB of an empty, T == 1.0 sketch with another est-mode sketch is empty, T < 1.0
     assertTrue(csk3.isEmpty());
@@ -99,7 +99,7 @@
 
   @Test
   public void checkPsampling() {
-    UpdateSketch sk1 = Sketches.updateSketchBuilder().setP(.5F).build();
+    final UpdateSketch sk1 = Sketches.updateSketchBuilder().setP(.5F).build();
     assertTrue(sk1.isEmpty());
     //An empty P-sampling sketch where T < 1.0 and has never seen data is also empty
     // and will have a full preamble of 24 bytes.  But when compacted, theta returns to 1.0, so
@@ -113,34 +113,34 @@
   public void checkBackwardCompatibility1() {
     final int k = 16;
     final int bytes = Sketches.getMaxUnionBytes(k); //288
-    Union union = SetOperation.builder().buildUnion(WritableMemory.allocate(bytes));
-    Memory mem = badEmptySk();
-    Sketch wsk = Sketches.wrapSketch(mem);
-    union.update(wsk); //union has memory
+    final Union union = SetOperation.builder().buildUnion(WritableMemory.allocate(bytes));
+    final Memory mem = badEmptySk();
+    final Sketch wsk = Sketches.wrapSketch(mem);
+    union.union(wsk); //union has memory
   }
 
   @Test
   public void checkBackwardCompatibility2() {
-    Union union = SetOperation.builder().setNominalEntries(16).buildUnion();
-    Memory mem = badEmptySk();
-    Sketch wsk = Sketches.wrapSketch(mem);
-    union.update(wsk); //heap union
+    final Union union = SetOperation.builder().setNominalEntries(16).buildUnion();
+    final Memory mem = badEmptySk();
+    final Sketch wsk = Sketches.wrapSketch(mem);
+    union.union(wsk); //heap union
   }
 
   @Test
   public void checkBackwardCompatibility3() {
-    Memory mem = badEmptySk();
+    final Memory mem = badEmptySk();
     Sketches.heapifySketch(mem);
   }
 
   @Test
   public void checkEmptyToCompact() {
-    UpdateSketch sk1 = Sketches.updateSketchBuilder().build();
-    CompactSketch csk = sk1.compact();
+    final UpdateSketch sk1 = Sketches.updateSketchBuilder().build();
+    final CompactSketch csk = sk1.compact();
     assertTrue(csk instanceof EmptyCompactSketch);
-    CompactSketch csk2 = csk.compact();
+    final CompactSketch csk2 = csk.compact();
     assertTrue(csk2 instanceof EmptyCompactSketch);
-    CompactSketch csk3 = csk.compact(true, WritableMemory.allocate(8));
+    final CompactSketch csk3 = csk.compact(true, WritableMemory.allocate(8));
     assertTrue(csk3 instanceof DirectCompactSketch);
     assertEquals(csk2.getCurrentPreambleLongs(), 1);
   }
@@ -151,11 +151,11 @@
     final long preLongs = 1;
     final long serVer = 2;
     final long family = 3; //compact
-    final long flags = (ORDERED_FLAG_MASK | COMPACT_FLAG_MASK | READ_ONLY_FLAG_MASK);
+    final long flags = ORDERED_FLAG_MASK | COMPACT_FLAG_MASK | READ_ONLY_FLAG_MASK;
     final long seedHash = 0x93CC;
-    final long badEmptySk = (seedHash << 48) | (flags << 40)
-        | (family << 16) | (serVer << 8) | preLongs;
-    WritableMemory wmem =  WritableMemory.allocate(8);
+    final long badEmptySk = seedHash << 48 | flags << 40
+        | family << 16 | serVer << 8 | preLongs;
+    final WritableMemory wmem =  WritableMemory.allocate(8);
     wmem.putLong(0, badEmptySk);
     return wmem;
   }
@@ -163,7 +163,7 @@
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/theta/ExamplesTest.java b/src/test/java/org/apache/datasketches/theta/ExamplesTest.java
index 64f618a..8a70dae 100644
--- a/src/test/java/org/apache/datasketches/theta/ExamplesTest.java
+++ b/src/test/java/org/apache/datasketches/theta/ExamplesTest.java
@@ -29,10 +29,10 @@
 
   @Test
   public void simpleCountingSketch() {
-    int k = 4096;
-    int u = 1000000;
+    final int k = 4096;
+    final int u = 1000000;
 
-    UpdateSketch sketch = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch sketch = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i = 0; i < u; i++) {
       sketch.update(i);
     }
@@ -60,6 +60,57 @@
   */
 
   @Test
+  public void theta2dot0Examples() {
+    //Load source sketches
+    final UpdateSketchBuilder bldr = UpdateSketch.builder();
+    final UpdateSketch skA = bldr.build();
+    final UpdateSketch skB = bldr.build();
+    for (int i = 1; i <= 1000; i++) {
+      skA.update(i);
+      skB.update(i + 250);
+    }
+
+    //Union Stateless:
+    Union union = SetOperation.builder().buildUnion();
+    CompactSketch csk = union.union(skA, skB);
+    assert csk.getEstimate() == 1250;
+
+    //Union Stateful:
+    union = SetOperation.builder().buildUnion();
+    union.union(skA); //first call
+    union.union(skB); //2nd through nth calls
+    //...
+    csk = union.getResult();
+    assert csk.getEstimate() == 1250;
+
+    //Intersection Stateless:
+    Intersection inter = SetOperation.builder().buildIntersection();
+    csk = inter.intersect(skA, skB);
+    assert csk.getEstimate() == 750;
+
+    //Intersection Stateful:
+    inter = SetOperation.builder().buildIntersection();
+    inter.intersect(skA); //first call
+    inter.intersect(skB); //2nd through nth calls
+    //...
+    csk = inter.getResult();
+    assert csk.getEstimate() == 750;
+
+    //AnotB Stateless:
+    AnotB diff = SetOperation.builder().buildANotB();
+    csk = diff.aNotB(skA, skB);
+    assert csk.getEstimate() == 250;
+
+    //AnotB Stateful:
+    diff = SetOperation.builder().buildANotB();
+    diff.setA(skA); //first call
+    diff.notB(skB); //2nd through nth calls
+    //...
+    csk = diff.getResult(true);
+    assert csk.getEstimate() == 250;
+  }
+
+  @Test
   public void printlnTest() {
     println("PRINTING: "+this.getClass().getName());
   }
@@ -67,7 +118,7 @@
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //enable/disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/theta/HeapUnionTest.java b/src/test/java/org/apache/datasketches/theta/HeapUnionTest.java
index 138112e..6c1240a 100644
--- a/src/test/java/org/apache/datasketches/theta/HeapUnionTest.java
+++ b/src/test/java/org/apache/datasketches/theta/HeapUnionTest.java
@@ -43,14 +43,14 @@
 
   @Test
   public void checkExactUnionNoOverlap() {
-    int lgK = 9; //512
-    int k = 1 << lgK;
-    int u = k;
+    final int lgK = 9; //512
+    final int k = 1 << lgK;
+    final int u = k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //256
     }
     for (int i=u/2; i<u; i++) {
@@ -59,74 +59,74 @@
 
     assertEquals(u, usk1.getEstimate() + usk2.getEstimate(), 0.0); //exact, no overlap
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.0);
   }
 
   @Test
   public void checkEstUnionNoOverlap() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //2*k
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i); //2*k no overlap
     }
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.05);
   }
 
   @Test
   public void checkExactUnionWithOverlap() {
-    int lgK = 9; //512
-    int k = 1 << lgK;
-    int u = k;
+    final int lgK = 9; //512
+    final int k = 1 << lgK;
+    final int u = k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //256
     }
     for (int i=0; i<u  ; i++) {
       usk2.update(i); //512, 256 overlapped
     }
 
-    assertEquals(u, usk1.getEstimate() + (usk2.getEstimate()/2), 0.0); //exact, overlapped
+    assertEquals(u, usk1.getEstimate() + usk2.getEstimate()/2, 0.0); //exact, overlapped
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.0);
   }
 
   @Test
   public void checkHeapifyExact() {
-    int lgK = 9; //512
-    int k = 1 << lgK;
-    int u = k;
+    final int lgK = 9; //512
+    final int k = 1 << lgK;
+    final int u = k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //256
     }
     for (int i=u/2; i<u; i++) {
@@ -135,77 +135,77 @@
 
     assertEquals(u, usk1.getEstimate() + usk2.getEstimate(), 0.0); //exact, no overlap
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch
 
     testAllCompactForms(union, u, 0.0);
 
-    Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
+    final Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.0);
   }
 
   @Test
   public void checkHeapifyEstNoOverlap() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //2k
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i); //2k no overlap, exact
     }
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1); //update with heap UpdateSketch
-    union.update(usk2); //update with heap UpdateSketch, early stop not possible
+    union.union(usk1); //update with heap UpdateSketch
+    union.union(usk2); //update with heap UpdateSketch, early stop not possible
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
+    final Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
   }
 
   @Test
   public void checkHeapifyEstNoOverlapOrderedIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i); //2k
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i); //2k no overlap, exact, will force early stop
     }
 
-    CompactSketch cosk2 = usk2.compact(true, null);
+    final CompactSketch cosk2 = usk2.compact(true, null);
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1);  //update with heap UpdateSketch
-    union.update(cosk2); //update with heap Compact, Ordered input, early stop
+    union.union(usk1);  //update with heap UpdateSketch
+    union.union(cosk2); //update with heap Compact, Ordered input, early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty
+    union.union(emptySketch); //updates with empty
     emptySketch = null;
-    union.update(emptySketch); //updates with null
+    union.union(emptySketch); //updates with null
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
+    final Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -215,36 +215,36 @@
 
   @Test
   public void checkWrapEstNoOverlapOrderedDirectIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i);  //2k estimating
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i);  //2k no overlap, exact, will force early stop
     }
 
-    WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
-    CompactSketch cosk2 = usk2.compact(true, cskMem2); //ordered, loads the cskMem2 as ordered
+    final WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
+    final CompactSketch cosk2 = usk2.compact(true, cskMem2); //ordered, loads the cskMem2 as ordered
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1);        //updates with heap UpdateSketch
-    union.update(cosk2);       //updates with direct CompactSketch, ordered, use early stop
+    union.union(usk1);        //updates with heap UpdateSketch
+    union.union(cosk2);       //updates with direct CompactSketch, ordered, use early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty sketch
+    union.union(emptySketch); //updates with empty sketch
     emptySketch = null;
-    union.update(emptySketch); //updates with null sketch
+    union.union(emptySketch); //updates with null sketch
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
+    final Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -254,36 +254,36 @@
 
   @Test
   public void checkHeapifyEstNoOverlapOrderedMemIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i);  //2k estimating
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i);  //2k no overlap, exact, will force early stop
     }
 
-    WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
+    final WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
     usk2.compact(true, cskMem2); //ordered, loads the cskMem2 as ordered
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1);        //updates with heap UpdateSketch
-    union.update(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
+    union.union(usk1);        //updates with heap UpdateSketch
+    union.union(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty sketch
+    union.union(emptySketch); //updates with empty sketch
     emptySketch = null;
-    union.update(emptySketch); //updates with null sketch
+    union.union(emptySketch); //updates with null sketch
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
+    final Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -293,36 +293,36 @@
 
   @Test
   public void checkHeapifyEstNoOverlapUnorderedMemIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 4*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 4*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();   //2k estimating
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(2 * k).build(); //2k exact for early stop test
 
-    for (int i=0; i<(u/2); i++) {
+    for (int i=0; i<u/2; i++) {
       usk1.update(i);  //2k estimating
     }
     for (int i=u/2; i<u; i++) {
       usk2.update(i);  //2k no overlap, exact, will force early stop
     }
 
-    WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
+    final WritableMemory cskMem2 = WritableMemory.wrap(new byte[usk2.getCompactBytes()]);
     usk2.compact(false, cskMem2); //unordered, loads the cskMem2 as unordered
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1);        //updates with heap UpdateSketch
-    union.update(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
+    union.union(usk1);        //updates with heap UpdateSketch
+    union.union(cskMem2);     //updates with direct CompactSketch, ordered, use early stop
 
     UpdateSketch emptySketch = UpdateSketch.builder().setNominalEntries(k).build();
-    union.update(emptySketch); //updates with empty sketch
+    union.union(emptySketch); //updates with empty sketch
     emptySketch = null;
-    union.update(emptySketch); //updates with null sketch
+    union.union(emptySketch); //updates with null sketch
 
     testAllCompactForms(union, u, 0.05);
 
-    Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
+    final Union union2 = (Union)SetOperation.heapify(Memory.wrap(union.toByteArray()));
 
     testAllCompactForms(union2, u, 0.05);
 
@@ -332,13 +332,13 @@
 
   @Test
   public void checkMultiUnion() {
-    int lgK = 13; //8192
-    int k = 1 << lgK;
+    final int lgK = 13; //8192
+    final int k = 1 << lgK;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk3 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk4 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk3 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk4 = UpdateSketch.builder().setNominalEntries(k).build();
 
     int v=0;
     int u = 1000000;
@@ -360,28 +360,28 @@
     }
     v += u;
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(usk1); //updates with heap UpdateSketch
-    union.update(usk2); //updates with heap UpdateSketch
-    union.update(usk3); //updates with heap UpdateSketch
-    union.update(usk4); //updates with heap UpdateSketch
+    union.union(usk1); //updates with heap UpdateSketch
+    union.union(usk2); //updates with heap UpdateSketch
+    union.union(usk3); //updates with heap UpdateSketch
+    union.union(usk4); //updates with heap UpdateSketch
 
-    CompactSketch csk = union.getResult(true, null);
-    double est = csk.getEstimate();
+    final CompactSketch csk = union.getResult(true, null);
+    final double est = csk.getEstimate();
     assertEquals(est, v, .01*v);
   }
 
   @Test
   public void checkDirectMemoryIn() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u1 = 2*k;
-    int u2 = 1024; //smaller exact sketch forces early stop
-    int totU = u1+u2;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u1 = 2*k;
+    final int u2 = 1024; //smaller exact sketch forces early stop
+    final int totU = u1+u2;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
     for (int i=0; i<u1; i++) {
       usk1.update(i); //2*k
@@ -390,31 +390,31 @@
       usk2.update(i); //2*k + 1024 no overlap
     }
 
-    WritableMemory skMem1 = WritableMemory.wrap(usk1.compact(false, null).toByteArray());
-    WritableMemory skMem2 = WritableMemory.wrap(usk2.compact(true, null).toByteArray());
+    final WritableMemory skMem1 = WritableMemory.wrap(usk1.compact(false, null).toByteArray());
+    final WritableMemory skMem2 = WritableMemory.wrap(usk2.compact(true, null).toByteArray());
 
-    CompactSketch csk1 = (CompactSketch)Sketch.wrap(skMem1);
-    CompactSketch csk2 = (CompactSketch)Sketch.wrap(skMem2);
+    final CompactSketch csk1 = (CompactSketch)Sketch.wrap(skMem1);
+    final CompactSketch csk2 = (CompactSketch)Sketch.wrap(skMem2);
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(csk1);
-    union.update(csk2);
+    union.union(csk1);
+    union.union(csk2);
 
-    CompactSketch cOut = union.getResult(true, null);
+    final CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), totU, .05*k);
   }
 
   @Test
   public void checkSerVer1Handling() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u1 = 2*k;
-    int u2 = 1024; //smaller exact sketch forces early stop
-    int totU = u1+u2;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u1 = 2*k;
+    final int u2 = 1024; //smaller exact sketch forces early stop
+    final int totU = u1+u2;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
     for (int i=0; i<u1; i++) {
       usk1.update(i); //2*k
@@ -423,28 +423,28 @@
       usk2.update(i); //2*k + 1024 no overlap
     }
 
-    Memory v1mem1 = convertSerVer3toSerVer1(usk1.compact(true, null));
-    Memory v1mem2 = convertSerVer3toSerVer1(usk2.compact(true, null));
+    final Memory v1mem1 = convertSerVer3toSerVer1(usk1.compact(true, null));
+    final Memory v1mem2 = convertSerVer3toSerVer1(usk2.compact(true, null));
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(v1mem1);
-    union.update(v1mem2);
+    union.union(v1mem1);
+    union.union(v1mem2);
 
-    CompactSketch cOut = union.getResult(true, null);
+    final CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), totU, .05*k);
   }
 
   @Test
   public void checkSerVer2Handling() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u1 = 2*k;
-    int u2 = 1024; //smaller exact sketch forces early stop
-    int totU = u1+u2;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u1 = 2*k;
+    final int u2 = 1024; //smaller exact sketch forces early stop
+    final int totU = u1+u2;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
     for (int i=0; i<u1; i++) {
       usk1.update(i); //2*k
@@ -453,121 +453,121 @@
       usk2.update(i); //2*k + 1024 no overlap
     }
 
-    Memory v2mem1 = convertSerVer3toSerVer2(usk1.compact(true, null), Util.DEFAULT_UPDATE_SEED);
-    Memory v2mem2 = convertSerVer3toSerVer2(usk2.compact(true, null), Util.DEFAULT_UPDATE_SEED);
+    final Memory v2mem1 = convertSerVer3toSerVer2(usk1.compact(true, null), Util.DEFAULT_UPDATE_SEED);
+    final Memory v2mem2 = convertSerVer3toSerVer2(usk2.compact(true, null), Util.DEFAULT_UPDATE_SEED);
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
 
-    union.update(v2mem1);
-    union.update(v2mem2);
+    union.union(v2mem1);
+    union.union(v2mem2);
 
-    CompactSketch cOut = union.getResult(true, null);
+    final CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), totU, .05*k);
   }
 
   @Test
   public void checkUpdateMemorySpecialCases() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
-    CompactSketch usk1c = usk1.compact(true, null);
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final CompactSketch usk1c = usk1.compact(true, null);
     WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
 
-    Memory v1mem1 = convertSerVer3toSerVer1(usk1.compact(true, null));
+    final Memory v1mem1 = convertSerVer3toSerVer1(usk1.compact(true, null));
 
     Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
-    union.update(v1mem1);
+    union.union(v1mem1);
     CompactSketch cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
 
-    Memory v2mem1 = convertSerVer3toSerVer2(usk1.compact(true, null), Util.DEFAULT_UPDATE_SEED);
+    final Memory v2mem1 = convertSerVer3toSerVer2(usk1.compact(true, null), Util.DEFAULT_UPDATE_SEED);
 
     union = SetOperation.builder().setNominalEntries(k).buildUnion();
-    union.update(v2mem1);
+    union.union(v2mem1);
     cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
 
     union = SetOperation.builder().setNominalEntries(k).buildUnion();
-    union.update(v3mem1);
+    union.union(v3mem1);
     cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
 
     union = SetOperation.builder().setNominalEntries(k).buildUnion();
     v3mem1 = null;
-    union.update(v3mem1);
+    union.union(v3mem1);
     cOut = union.getResult(true, null);
     assertEquals(cOut.getEstimate(), 0.0, 0.0);
   }
 
   @Test
   public void checkUpdateMemorySpecialCases2() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    int u = 2*k;
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final int u = 2*k;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i=0; i<u; i++)
      {
       usk1.update(i); //force prelongs to 3
     }
-    CompactSketch usk1c = usk1.compact(true, null);
-    WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
+    final CompactSketch usk1c = usk1.compact(true, null);
+    final WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
     //println(PreambleUtil.toString(v3mem1));
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
-    union.update(v3mem1);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    union.union(v3mem1);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkMemBadSerVer() {
-    int lgK = 12; //4096
-    int k = 1 << lgK;
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final int lgK = 12; //4096
+    final int k = 1 << lgK;
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     usk1.update(1);
     usk1.update(2);
-    CompactSketch usk1c = usk1.compact(true, null);
-    WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
+    final CompactSketch usk1c = usk1.compact(true, null);
+    final WritableMemory v3mem1 = WritableMemory.wrap(usk1c.toByteArray());
     //corrupt SerVer
     v3mem1.putByte(SER_VER_BYTE, (byte)0);
 
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
-    union.update(v3mem1);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion();
+    union.union(v3mem1);
   }
 
   @Test
   public void checkEmptySerVer2and3() {
-    UpdateSketch usk1 = UpdateSketch.builder().build();
-    CompactSketch usk1c = usk1.compact(true, null);
-    byte[] skArr = usk1c.toByteArray();
-    byte[] skArr2 = Arrays.copyOf(skArr, skArr.length * 2);
-    WritableMemory v3mem1 = WritableMemory.wrap(skArr2);
+    final UpdateSketch usk1 = UpdateSketch.builder().build();
+    final CompactSketch usk1c = usk1.compact(true, null);
+    final byte[] skArr = usk1c.toByteArray();
+    final byte[] skArr2 = Arrays.copyOf(skArr, skArr.length * 2);
+    final WritableMemory v3mem1 = WritableMemory.wrap(skArr2);
 
     Union union = SetOperation.builder().buildUnion();
-    union.update(v3mem1);
+    union.union(v3mem1);
 
-    Memory v2mem1 = convertSerVer3toSerVer2(usk1c, Util.DEFAULT_UPDATE_SEED);
-    WritableMemory v2mem2 = WritableMemory.wrap(new byte[16]);
+    final Memory v2mem1 = convertSerVer3toSerVer2(usk1c, Util.DEFAULT_UPDATE_SEED);
+    final WritableMemory v2mem2 = WritableMemory.wrap(new byte[16]);
     v2mem1.copyTo(0, v2mem2, 0, 8);
 
     union = SetOperation.builder().buildUnion();
-    union.update(v2mem2);
+    union.union(v2mem2);
   }
 
   @Test
   public void checkGetResult() {
-    int k = 1024;
-    UpdateSketch sk = Sketches.updateSketchBuilder().build();
+    final int k = 1024;
+    final UpdateSketch sk = Sketches.updateSketchBuilder().build();
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(sk);
-    CompactSketch csk = union.getResult();
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(sk);
+    final CompactSketch csk = union.getResult();
     assertEquals(csk.getCompactBytes(), 8);
   }
 
   @Test
   public void checkPrimitiveUpdates() {
-    int k = 32;
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    final int k = 32;
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
 
     union.update(1L);   //#1 long
     union.update(1.5);  //#2 double
@@ -598,34 +598,34 @@
     union.update(intArr); //null int[]
     intArr = new int[0];
     union.update(intArr); //empty int[]
-    int[] intArr2 = { 1, 2, 3, 4, 5 };
+    final int[] intArr2 = { 1, 2, 3, 4, 5 };
     union.update(intArr2); //#7 actual int[]
 
     long[] longArr = null;
     union.update(longArr); //null long[]
     longArr = new long[0];
     union.update(longArr); //empty long[]
-    long[] longArr2 = { 6, 7, 8, 9 };
+    final long[] longArr2 = { 6, 7, 8, 9 };
     union.update(longArr2); //#8 actual long[]
 
-    CompactSketch comp = union.getResult();
-    double est = comp.getEstimate();
-    boolean empty = comp.isEmpty();
+    final CompactSketch comp = union.getResult();
+    final double est = comp.getEstimate();
+    final boolean empty = comp.isEmpty();
     assertEquals(est, 8.0, 0.0);
     assertFalse(empty);
   }
 
   //used by DirectUnionTest as well
-  public static void testAllCompactForms(Union union, double expected, double toll) {
+  public static void testAllCompactForms(final Union union, final double expected, final double toll) {
     double compEst1, compEst2;
     compEst1 = union.getResult(false, null).getEstimate(); //not ordered, no mem
     assertEquals(compEst1, expected, toll*expected);
 
-    CompactSketch comp2 = union.getResult(true, null); //ordered, no mem
+    final CompactSketch comp2 = union.getResult(true, null); //ordered, no mem
     compEst2 = comp2.getEstimate();
     assertEquals(compEst2, compEst1, 0.0);
 
-    WritableMemory mem = WritableMemory.wrap(new byte[comp2.getCurrentBytes()]);
+    final WritableMemory mem = WritableMemory.wrap(new byte[comp2.getCurrentBytes()]);
 
     compEst2 = union.getResult(false, mem).getEstimate(); //not ordered, mem
     assertEquals(compEst2, compEst1, 0.0);
@@ -636,7 +636,7 @@
 
   @Test
   public void checkGetFamily() {
-    SetOperation setOp = new SetOperationBuilder().build(Family.UNION);
+    final SetOperation setOp = new SetOperationBuilder().build(Family.UNION);
     assertEquals(setOp.getFamily(), Family.UNION);
   }
 
@@ -648,7 +648,7 @@
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //Disable here
   }
 }
diff --git a/src/test/java/org/apache/datasketches/theta/PreambleUtilTest.java b/src/test/java/org/apache/datasketches/theta/PreambleUtilTest.java
index dc8a49f..5088510 100644
--- a/src/test/java/org/apache/datasketches/theta/PreambleUtilTest.java
+++ b/src/test/java/org/apache/datasketches/theta/PreambleUtilTest.java
@@ -70,13 +70,13 @@
 
   @Test
   public void checkToString() {
-    int k = 4096;
-    int u = 2*k;
-    int bytes = (k << 4) + (Family.QUICKSELECT.getMinPreLongs() << 3);
-    byte[] byteArray = new byte[bytes];
-    WritableMemory mem = WritableMemory.wrap(byteArray);
+    final int k = 4096;
+    final int u = 2*k;
+    final int bytes = (k << 4) + (Family.QUICKSELECT.getMinPreLongs() << 3);
+    final byte[] byteArray = new byte[bytes];
+    final WritableMemory mem = WritableMemory.wrap(byteArray);
 
-    UpdateSketch quick1 = UpdateSketch.builder().setNominalEntries(k).build(mem);
+    final UpdateSketch quick1 = UpdateSketch.builder().setNominalEntries(k).build(mem);
     println(Sketch.toString(byteArray));
 
     Assert.assertTrue(quick1.isEmpty());
@@ -91,21 +91,21 @@
     println(quick1.toString());
     println(PreambleUtil.preambleToString(mem));
 
-    WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
-    Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
-    union.update(quick1);
+    final WritableMemory uMem = WritableMemory.wrap(new byte[getMaxUnionBytes(k)]);
+    final Union union = SetOperation.builder().setNominalEntries(k).buildUnion(uMem);
+    union.union(quick1);
     println(PreambleUtil.preambleToString(uMem));
   }
 
   @Test
   public void checkToStringWithPrelongsOf2() {
-    int k = 16;
-    int u = k;
-    UpdateSketch quick1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final int k = 16;
+    final int u = k;
+    final UpdateSketch quick1 = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i = 0; i< u; i++) {
       quick1.update(i);
     }
-    byte[] bytes = quick1.compact().toByteArray();
+    final byte[] bytes = quick1.compact().toByteArray();
     println(Sketch.toString(bytes));
   }
 
@@ -115,7 +115,7 @@
     try { //check preLongs < 8 fails
       Sketch.toString(byteArr);
       fail("Did not throw SketchesArgumentException.");
-    } catch (SketchesArgumentException e) {
+    } catch (final SketchesArgumentException e) {
       //expected
     }
     byteArr = new byte[8];
@@ -123,7 +123,7 @@
     try { //check preLongs == 2 fails
       Sketch.toString(Memory.wrap(byteArr));
       fail("Did not throw SketchesArgumentException.");
-    } catch (SketchesArgumentException e) {
+    } catch (final SketchesArgumentException e) {
       //expected
     }
   }
@@ -136,7 +136,7 @@
 
   @Test
   public void checkPreLongs() {
-    UpdateSketch sketch = UpdateSketch.builder().setNominalEntries(16).build();
+    final UpdateSketch sketch = UpdateSketch.builder().setNominalEntries(16).build();
     CompactSketch comp = sketch.compact(false, null);
     byte[] byteArr = comp.toByteArray();
     println(Sketch.toString(byteArr)); //PreLongs = 1
@@ -156,8 +156,8 @@
 
   @Test
   public void checkInsertsAndExtracts() {
-    byte[] arr = new byte[32];
-    WritableMemory wmem = WritableMemory.wrap(arr);
+    final byte[] arr = new byte[32];
+    final WritableMemory wmem = WritableMemory.wrap(arr);
 
     int v = 0;
     insertPreLongs(wmem, ++v);
@@ -225,7 +225,7 @@
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/theta/SetOperationTest.java b/src/test/java/org/apache/datasketches/theta/SetOperationTest.java
index a599f40..179a0c2 100644
--- a/src/test/java/org/apache/datasketches/theta/SetOperationTest.java
+++ b/src/test/java/org/apache/datasketches/theta/SetOperationTest.java
@@ -48,55 +48,55 @@
 
   @Test
   public void checkBuilder() {
-    int k = 2048;
-    long seed = 1021;
+    final int k = 2048;
+    final long seed = 1021;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setSeed(seed).setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setSeed(seed).setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setSeed(seed).setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setSeed(seed).setNominalEntries(k).build();
 
-    for (int i=0; i<(k/2); i++) {
+    for (int i=0; i<k/2; i++) {
       usk1.update(i); //256
     }
     for (int i=k/2; i<k; i++) {
       usk2.update(i); //256 no overlap
     }
 
-    ResizeFactor rf = X4;
+    final ResizeFactor rf = X4;
     //use default size
-    Union union = SetOperation.builder().setSeed(seed).setResizeFactor(rf).buildUnion();
+    final Union union = SetOperation.builder().setSeed(seed).setResizeFactor(rf).buildUnion();
 
-    union.update(usk1);
-    union.update(usk2);
+    union.union(usk1);
+    union.union(usk2);
 
-    double exactUnionAnswer = k;
+    final double exactUnionAnswer = k;
 
-    CompactSketch comp1 = union.getResult(false, null); //ordered: false
-    double compEst = comp1.getEstimate();
+    final CompactSketch comp1 = union.getResult(false, null); //ordered: false
+    final double compEst = comp1.getEstimate();
     assertEquals(compEst, exactUnionAnswer, 0.0);
   }
 
   @Test
   public void checkBuilder2() {
-    SetOperationBuilder bldr = SetOperation.builder();
+    final SetOperationBuilder bldr = SetOperation.builder();
 
-    long seed = 12345L;
+    final long seed = 12345L;
     bldr.setSeed(seed);
     assertEquals(bldr.getSeed(), seed);
 
-    float p = (float)0.5;
+    final float p = (float)0.5;
     bldr.setP(p);
     assertEquals(bldr.getP(), p);
 
-    ResizeFactor rf = ResizeFactor.X4;
+    final ResizeFactor rf = ResizeFactor.X4;
     bldr.setResizeFactor(rf);
     assertEquals(bldr.getResizeFactor(), rf);
 
-    int lgK = 10;
-    int k = 1 << lgK;
+    final int lgK = 10;
+    final int k = 1 << lgK;
     bldr.setNominalEntries(k);
     assertEquals(bldr.getLgNominalEntries(), lgK);
 
-    MemoryRequestServer mrs = new DefaultMemoryRequestServer();
+    final MemoryRequestServer mrs = new DefaultMemoryRequestServer();
     bldr.setMemoryRequestServer(mrs);
     assertEquals(bldr.getMemoryRequestServer(), mrs);
 
@@ -115,109 +115,109 @@
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkBuilderIllegalPhi() {
-    float p = (float)1.5;
+    final float p = (float)1.5;
     SetOperation.builder().setP(p).buildUnion();
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkBuilderIllegalPlo() {
-    float p = 0;
+    final float p = 0;
     SetOperation.builder().setP(p).buildUnion();
   }
 
   @Test
   public void checkBuilderValidP() {
-    float p = (float).5;
+    final float p = (float).5;
     SetOperation.builder().setP(p).buildUnion();
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkBuilderAnotB_noMem() {
-    WritableMemory mem = WritableMemory.wrap(new byte[64]);
+    final WritableMemory mem = WritableMemory.wrap(new byte[64]);
     SetOperation.builder().build(Family.A_NOT_B, mem);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkBuilderBadSeedHashes() {
-    int k = 2048;
-    long seed = 1021;
+    final int k = 2048;
+    final long seed = 1021;
 
-    UpdateSketch usk1 = UpdateSketch.builder().setSeed(seed).setNominalEntries(k).build();
-    UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
+    final UpdateSketch usk1 = UpdateSketch.builder().setSeed(seed).setNominalEntries(k).build();
+    final UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build();
 
-    for (int i=0; i<(k/2); i++) {
+    for (int i=0; i<k/2; i++) {
       usk1.update(i); //256
     }
     for (int i=k/2; i<k; i++) {
       usk2.update(i); //256 no overlap
     }
 
-    ResizeFactor rf = X4;
+    final ResizeFactor rf = X4;
 
-    Union union = SetOperation.builder().setSeed(seed).setResizeFactor(rf).setNominalEntries(k).buildUnion();
+    final Union union = SetOperation.builder().setSeed(seed).setResizeFactor(rf).setNominalEntries(k).buildUnion();
 
-    union.update(usk1);
-    union.update(usk2); //throws seed exception here
+    union.union(usk1);
+    union.union(usk2); //throws seed exception here
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkBuilderNomEntries() {
-    int k = 1 << 27;
-    SetOperationBuilder bldr = SetOperation.builder();
+    final int k = 1 << 27;
+    final SetOperationBuilder bldr = SetOperation.builder();
     bldr.setNominalEntries(k);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkIllegalSetOpHeapify() {
-    int k = 64;
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final int k = 64;
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) {
       usk1.update(i); //64
     }
-    byte[] byteArray = usk1.toByteArray();
-    Memory mem = Memory.wrap(byteArray);
+    final byte[] byteArray = usk1.toByteArray();
+    final Memory mem = Memory.wrap(byteArray);
     SetOperation.heapify(mem);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkIllegalSetOpWrap() {
-    int k = 64;
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final int k = 64;
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) {
       usk1.update(i); //64
     }
-    byte[] byteArray = usk1.toByteArray();
-    Memory mem = Memory.wrap(byteArray);
+    final byte[] byteArray = usk1.toByteArray();
+    final Memory mem = Memory.wrap(byteArray);
     Sketches.wrapIntersection(mem);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkIllegalSetOpWrap2() {
-    int k = 64;
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final int k = 64;
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) {
       usk1.update(i); //64
     }
-    WritableMemory wmem = WritableMemory.wrap(usk1.toByteArray());
+    final WritableMemory wmem = WritableMemory.wrap(usk1.toByteArray());
     PreambleUtil.insertSerVer(wmem, 2); //corrupt
-    Memory mem = wmem;
+    final Memory mem = wmem;
     SetOperation.wrap(mem);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkIllegalSetOpWrap3() {
-    int k = 64;
-    UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
+    final int k = 64;
+    final UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) {
       usk1.update(i); //64
     }
-    WritableMemory wmem = WritableMemory.wrap(usk1.toByteArray());
+    final WritableMemory wmem = WritableMemory.wrap(usk1.toByteArray());
     SetOperation.wrap(wmem);
   }
 
   @Test
   public void checkBuildSetOps() {
-    SetOperationBuilder bldr = Sketches.setOperationBuilder();
+    final SetOperationBuilder bldr = Sketches.setOperationBuilder();
     bldr.buildUnion();
     bldr.buildIntersection();
     bldr.buildANotB();
@@ -242,16 +242,16 @@
   public void checkDirectUnionExample() {
     //The first task is to compute how much direct memory we need and set the heap large enough.
     //For the first trial, we will set the Union large enough for an exact result for THIS example.
-    int sketchNomEntries = 1 << 14; //16K
+    final int sketchNomEntries = 1 << 14; //16K
     int unionNomEntries = 1 << 15;  //32K
-    int[] heapLayout = getHeapLayout(sketchNomEntries, unionNomEntries);
+    final int[] heapLayout = getHeapLayout(sketchNomEntries, unionNomEntries);
 
     //This BB belongs to you and you always retain a link to it until you are completely
     // done and then let java garbage collect it.
     //I use a heap backing array, because for this example it is easier to peak into it and
     // see what is going on.
-    byte[] backingArr = new byte[heapLayout[5]];
-    ByteBuffer heapBuf = ByteBuffer.wrap(backingArr).order(ByteOrder.nativeOrder());
+    final byte[] backingArr = new byte[heapLayout[5]];
+    final ByteBuffer heapBuf = ByteBuffer.wrap(backingArr).order(ByteOrder.nativeOrder());
 
     // Attaches a WritableMemory object to the underlying memory of heapBuf.
     // heapMem will have a Read/Write view of the complete backing memory of heapBuf (direct or not).
@@ -260,11 +260,11 @@
     // However, if you had created this WM object directly in raw, off-heap "native" memory
     // you would have the responsibility to close it when you are done.
     // But, since it was allocated via BB, it closes it for you.
-    WritableMemory heapMem = WritableMemory.wrap(heapBuf);
+    final WritableMemory heapMem = WritableMemory.wrap(heapBuf);
 
     double result = directUnionTrial1(heapMem, heapLayout, sketchNomEntries, unionNomEntries);
     println("1st est: "+result);
-    int expected = sketchNomEntries*2;
+    final int expected = sketchNomEntries*2;
     assertEquals(result, expected, 0.0); //est must be exact.
 
     //For trial 2, we will use the same union space but use only part of it.
@@ -274,61 +274,61 @@
     //intentionally loose bounds
     assertEquals(result, expected, expected*0.05);
     println("2nd est: "+result);
-    println("Error %: "+(((result/expected) -1.0)*100));
+    println("Error %: "+(result/expected -1.0)*100);
   }
 
   @Test
   public void setOpsExample() {
     println("Set Operations Example:");
-    int k = 4096;
-    UpdateSketch skA = Sketches.updateSketchBuilder().setNominalEntries(k).build();
-    UpdateSketch skB = Sketches.updateSketchBuilder().setNominalEntries(k).build();
-    UpdateSketch skC = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final int k = 4096;
+    final UpdateSketch skA = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final UpdateSketch skB = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final UpdateSketch skC = Sketches.updateSketchBuilder().setNominalEntries(k).build();
 
     for (int i=1;  i<=10; i++) { skA.update(i); }
     for (int i=1;  i<=20; i++) { skB.update(i); }
     for (int i=6;  i<=15; i++) { skC.update(i); } //overlapping set
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(skA);
-    union.update(skB);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(skA);
+    union.union(skB);
     // ... continue to iterate on the input sketches to union
 
-    CompactSketch unionSk = union.getResult();   //the result union sketch
+    final CompactSketch unionSk = union.getResult();   //the result union sketch
     println("A U B      : "+unionSk.getEstimate());   //the estimate of the union
 
     //Intersection is similar
 
-    Intersection inter = Sketches.setOperationBuilder().buildIntersection();
+    final Intersection inter = Sketches.setOperationBuilder().buildIntersection();
     inter.intersect(unionSk);
     inter.intersect(skC);
     // ... continue to iterate on the input sketches to intersect
 
-    CompactSketch interSk = inter.getResult();  //the result intersection sketch
+    final CompactSketch interSk = inter.getResult();  //the result intersection sketch
     println("(A U B) ^ C: "+interSk.getEstimate());  //the estimate of the intersection
 
     //The AnotB operation is a little different as it is stateless:
 
-    AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
-    CompactSketch not = aNotB.aNotB(skA, skC);
+    final AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
+    final CompactSketch not = aNotB.aNotB(skA, skC);
 
     println("A \\ C      : "+not.getEstimate()); //the estimate of the AnotB operation
   }
 
   @Test
   public void checkIsSameResource() {
-    int k = 16;
-    WritableMemory wmem = WritableMemory.wrap(new byte[(k*16) + 32]);
-    Memory roCompactMem = Memory.wrap(new byte[8]);
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion(wmem);
+    final int k = 16;
+    final WritableMemory wmem = WritableMemory.wrap(new byte[k*16 + 32]);
+    final Memory roCompactMem = Memory.wrap(new byte[8]);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion(wmem);
     assertTrue(union.isSameResource(wmem));
     assertFalse(union.isSameResource(roCompactMem));
 
-    Intersection inter = Sketches.setOperationBuilder().buildIntersection(wmem);
+    final Intersection inter = Sketches.setOperationBuilder().buildIntersection(wmem);
     assertTrue(inter.isSameResource(wmem));
     assertFalse(inter.isSameResource(roCompactMem));
 
-    AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
+    final AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
 
     assertFalse(aNotB.isSameResource(roCompactMem));
   }
@@ -341,7 +341,7 @@
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
@@ -351,44 +351,44 @@
    * @param unionNomEntries configured nominal entries of the union
    * @return array of offsets for Union, sketch1, sketch2, sketch3, resultSketch, total layout
    */
-  private static int[] getHeapLayout(int sketchNomEntries, int unionNomEntries) {
-    int[] heapLayout = new int[6];
-    int unionBytes = SetOperation.getMaxUnionBytes(unionNomEntries);
-    int sketchBytes = getMaxUpdateSketchBytes(sketchNomEntries);
-    int resultBytes = Sketch.getMaxCompactSketchBytes(unionNomEntries);
+  private static int[] getHeapLayout(final int sketchNomEntries, final int unionNomEntries) {
+    final int[] heapLayout = new int[6];
+    final int unionBytes = SetOperation.getMaxUnionBytes(unionNomEntries);
+    final int sketchBytes = getMaxUpdateSketchBytes(sketchNomEntries);
+    final int resultBytes = Sketch.getMaxCompactSketchBytes(unionNomEntries);
     heapLayout[0] = 0;                             //offset for Union
     heapLayout[1] = unionBytes;                    //offset for sketch1
     heapLayout[2] = unionBytes + sketchBytes;      //offset for sketch2
-    heapLayout[3] = unionBytes + (2*sketchBytes);    //offset for sketch3
-    heapLayout[4] = unionBytes + (3*sketchBytes);    //offset for result
-    heapLayout[5] = unionBytes + (3*sketchBytes) + resultBytes;  //total
+    heapLayout[3] = unionBytes + 2*sketchBytes;    //offset for sketch3
+    heapLayout[4] = unionBytes + 3*sketchBytes;    //offset for result
+    heapLayout[5] = unionBytes + 3*sketchBytes + resultBytes;  //total
     return heapLayout;
   }
 
   private static double directUnionTrial1(
-      WritableMemory heapMem, int[] heapLayout, int sketchNomEntries, int unionNomEntries) {
+      final WritableMemory heapMem, final int[] heapLayout, final int sketchNomEntries, final int unionNomEntries) {
 
-    int offset = heapLayout[0];
-    int bytes = heapLayout[1] - offset;
-    WritableMemory unionMem = heapMem.writableRegion(offset, bytes);
+    final int offset = heapLayout[0];
+    final int bytes = heapLayout[1] - offset;
+    final WritableMemory unionMem = heapMem.writableRegion(offset, bytes);
 
     Union union = SetOperation.builder().setNominalEntries(unionNomEntries).buildUnion(unionMem);
 
-    WritableMemory sketch1mem = heapMem.writableRegion(heapLayout[1], heapLayout[2]-heapLayout[1]);
-    WritableMemory sketch2mem = heapMem.writableRegion(heapLayout[2], heapLayout[3]-heapLayout[2]);
-    WritableMemory sketch3mem = heapMem.writableRegion(heapLayout[3], heapLayout[4]-heapLayout[3]);
-    WritableMemory resultMem = heapMem.writableRegion(heapLayout[4], heapLayout[5]-heapLayout[4]);
+    final WritableMemory sketch1mem = heapMem.writableRegion(heapLayout[1], heapLayout[2]-heapLayout[1]);
+    final WritableMemory sketch2mem = heapMem.writableRegion(heapLayout[2], heapLayout[3]-heapLayout[2]);
+    final WritableMemory sketch3mem = heapMem.writableRegion(heapLayout[3], heapLayout[4]-heapLayout[3]);
+    final WritableMemory resultMem = heapMem.writableRegion(heapLayout[4], heapLayout[5]-heapLayout[4]);
 
     //Initialize the 3 sketches
-    UpdateSketch sk1 = UpdateSketch.builder().setNominalEntries(sketchNomEntries).build(sketch1mem);
-    UpdateSketch sk2 = UpdateSketch.builder().setNominalEntries(sketchNomEntries).build(sketch2mem);
-    UpdateSketch sk3 = UpdateSketch.builder().setNominalEntries(sketchNomEntries).build(sketch3mem);
+    final UpdateSketch sk1 = UpdateSketch.builder().setNominalEntries(sketchNomEntries).build(sketch1mem);
+    final UpdateSketch sk2 = UpdateSketch.builder().setNominalEntries(sketchNomEntries).build(sketch2mem);
+    final UpdateSketch sk3 = UpdateSketch.builder().setNominalEntries(sketchNomEntries).build(sketch3mem);
 
     //This little trial has sk1 and sk2 distinct and sk2 overlap both.
     //Build the sketches.
     for (int i=0; i< sketchNomEntries; i++) {
       sk1.update(i);
-      sk2.update(i + (sketchNomEntries/2));
+      sk2.update(i + sketchNomEntries/2);
       sk3.update(i + sketchNomEntries);
     }
 
@@ -398,32 +398,32 @@
     assertEquals(sk3.getEstimate(), sketchNomEntries, 0.0);
 
     //Let's union the first 2 sketches
-    union.update(sk1);
-    union.update(sk2);
+    union.union(sk1);
+    union.union(sk2);
 
     //Let's recover the union and the 3rd sketch
     union = Sketches.wrapUnion(unionMem);
-    union.update(Sketch.wrap(sketch3mem));
+    union.union(Sketch.wrap(sketch3mem));
 
-    Sketch resSk = union.getResult(true, resultMem);
-    double est = resSk.getEstimate();
+    final Sketch resSk = union.getResult(true, resultMem);
+    final double est = resSk.getEstimate();
 
     return est;
   }
 
   private static double directUnionTrial2(
-      WritableMemory heapMem, int[] heapLayout, int sketchNomEntries, int unionNomEntries) {
+      final WritableMemory heapMem, final int[] heapLayout, final int sketchNomEntries, final int unionNomEntries) {
 
-    WritableMemory unionMem = heapMem.writableRegion(heapLayout[0], heapLayout[1]-heapLayout[0]);
-    WritableMemory sketch1mem = heapMem.writableRegion(heapLayout[1], heapLayout[2]-heapLayout[1]);
-    WritableMemory sketch2mem = heapMem.writableRegion(heapLayout[2], heapLayout[3]-heapLayout[2]);
-    WritableMemory sketch3mem = heapMem.writableRegion(heapLayout[3], heapLayout[4]-heapLayout[3]);
-    WritableMemory resultMem = heapMem.writableRegion(heapLayout[4], heapLayout[5]-heapLayout[4]);
+    final WritableMemory unionMem = heapMem.writableRegion(heapLayout[0], heapLayout[1]-heapLayout[0]);
+    final WritableMemory sketch1mem = heapMem.writableRegion(heapLayout[1], heapLayout[2]-heapLayout[1]);
+    final WritableMemory sketch2mem = heapMem.writableRegion(heapLayout[2], heapLayout[3]-heapLayout[2]);
+    final WritableMemory sketch3mem = heapMem.writableRegion(heapLayout[3], heapLayout[4]-heapLayout[3]);
+    final WritableMemory resultMem = heapMem.writableRegion(heapLayout[4], heapLayout[5]-heapLayout[4]);
 
     //Recover the 3 sketches
-    UpdateSketch sk1 = (UpdateSketch) Sketch.wrap(sketch1mem);
-    UpdateSketch sk2 = (UpdateSketch) Sketch.wrap(sketch2mem);
-    UpdateSketch sk3 = (UpdateSketch) Sketch.wrap(sketch3mem);
+    final UpdateSketch sk1 = (UpdateSketch) Sketch.wrap(sketch1mem);
+    final UpdateSketch sk2 = (UpdateSketch) Sketch.wrap(sketch2mem);
+    final UpdateSketch sk3 = (UpdateSketch) Sketch.wrap(sketch3mem);
 
     //confirm that each of these 3 sketches is exact.
     assertEquals(sk1.getEstimate(), sketchNomEntries, 0.0);
@@ -432,13 +432,13 @@
 
     //Create a new union in the same space with a smaller size.
     unionMem.clear();
-    Union union = SetOperation.builder().setNominalEntries(unionNomEntries).buildUnion(unionMem);
-    union.update(sk1);
-    union.update(sk2);
-    union.update(sk3);
+    final Union union = SetOperation.builder().setNominalEntries(unionNomEntries).buildUnion(unionMem);
+    union.union(sk1);
+    union.union(sk2);
+    union.union(sk3);
 
-    Sketch resSk = union.getResult(true, resultMem);
-    double est = resSk.getEstimate();
+    final Sketch resSk = union.getResult(true, resultMem);
+    final double est = resSk.getEstimate();
 
     return est;
   }
diff --git a/src/test/java/org/apache/datasketches/theta/SketchesTest.java b/src/test/java/org/apache/datasketches/theta/SketchesTest.java
index 0854bd6..6a92ec0 100644
--- a/src/test/java/org/apache/datasketches/theta/SketchesTest.java
+++ b/src/test/java/org/apache/datasketches/theta/SketchesTest.java
@@ -35,12 +35,11 @@
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
-import org.testng.annotations.Test;
-
-import org.apache.datasketches.memory.Memory;
-import org.apache.datasketches.memory.WritableMemory;
 import org.apache.datasketches.SketchesArgumentException;
 import org.apache.datasketches.Util;
+import org.apache.datasketches.memory.Memory;
+import org.apache.datasketches.memory.WritableMemory;
+import org.testng.annotations.Test;
 
 /**
  * @author Lee Rhodes
@@ -48,25 +47,25 @@
 @SuppressWarnings("javadoc")
 public class SketchesTest {
 
-  private static Memory getCompactSketchMemory(int k, int from, int to) {
-    UpdateSketch sk1 = updateSketchBuilder().setNominalEntries(k).build();
+  private static Memory getCompactSketchMemory(final int k, final int from, final int to) {
+    final UpdateSketch sk1 = updateSketchBuilder().setNominalEntries(k).build();
     for (int i=from; i<to; i++) {
       sk1.update(i);
     }
-    CompactSketch csk = sk1.compact(true, null);
-    byte[] sk1bytes = csk.toByteArray();
-    Memory mem = Memory.wrap(sk1bytes);
+    final CompactSketch csk = sk1.compact(true, null);
+    final byte[] sk1bytes = csk.toByteArray();
+    final Memory mem = Memory.wrap(sk1bytes);
     return mem;
   }
 
-  private static Memory getMemoryFromCompactSketch(CompactSketch csk) {
-    byte[] sk1bytes = csk.toByteArray();
-    Memory mem = Memory.wrap(sk1bytes);
+  private static Memory getMemoryFromCompactSketch(final CompactSketch csk) {
+    final byte[] sk1bytes = csk.toByteArray();
+    final Memory mem = Memory.wrap(sk1bytes);
     return mem;
   }
 
-  private static CompactSketch getCompactSketch(int k, int from, int to) {
-    UpdateSketch sk1 = updateSketchBuilder().setNominalEntries(k).build();
+  private static CompactSketch getCompactSketch(final int k, final int from, final int to) {
+    final UpdateSketch sk1 = updateSketchBuilder().setNominalEntries(k).build();
     for (int i=from; i<to; i++) {
       sk1.update(i);
     }
@@ -75,8 +74,8 @@
 
   @Test
   public void checkSketchMethods() {
-    int k = 1024;
-    Memory mem = getCompactSketchMemory(k, 0, k);
+    final int k = 1024;
+    final Memory mem = getCompactSketchMemory(k, 0, k);
 
     CompactSketch csk2 = (CompactSketch)heapifySketch(mem);
     assertEquals((int)csk2.getEstimate(), k);
@@ -93,91 +92,91 @@
 
   @Test
   public void checkSetOpMethods() {
-    int k = 1024;
-    Memory mem1 = getCompactSketchMemory(k, 0, k);
-    Memory mem2 = getCompactSketchMemory(k, k/2, (3*k)/2);
+    final int k = 1024;
+    final Memory mem1 = getCompactSketchMemory(k, 0, k);
+    final Memory mem2 = getCompactSketchMemory(k, k/2, 3*k/2);
 
-    SetOperationBuilder bldr = setOperationBuilder();
-    Union union = bldr.setNominalEntries(2 * k).buildUnion();
+    final SetOperationBuilder bldr = setOperationBuilder();
+    final Union union = bldr.setNominalEntries(2 * k).buildUnion();
 
-    union.update(mem1);
+    union.union(mem1);
     CompactSketch cSk = union.getResult(true, null);
     assertEquals((int)cSk.getEstimate(), k);
-    union.update(mem2);
+    union.union(mem2);
     cSk = union.getResult(true, null);
-    assertEquals((int)cSk.getEstimate(), (3*k)/2);
+    assertEquals((int)cSk.getEstimate(), 3*k/2);
 
-    byte[] ubytes = union.toByteArray();
-    WritableMemory uMem = WritableMemory.wrap(ubytes);
+    final byte[] ubytes = union.toByteArray();
+    final WritableMemory uMem = WritableMemory.wrap(ubytes);
 
     Union union2 = (Union)heapifySetOperation(uMem);
     cSk = union2.getResult(true, null);
-    assertEquals((int)cSk.getEstimate(), (3*k)/2);
+    assertEquals((int)cSk.getEstimate(), 3*k/2);
 
     union2 = (Union)heapifySetOperation(uMem, Util.DEFAULT_UPDATE_SEED);
     cSk = union2.getResult(true, null);
-    assertEquals((int)cSk.getEstimate(), (3*k)/2);
+    assertEquals((int)cSk.getEstimate(), 3*k/2);
 
     union2 = (Union)wrapSetOperation(uMem);
     cSk = union2.getResult(true, null);
-    assertEquals((int)cSk.getEstimate(), (3*k)/2);
+    assertEquals((int)cSk.getEstimate(), 3*k/2);
 
     union2 = (Union)wrapSetOperation(uMem, Util.DEFAULT_UPDATE_SEED);
     cSk = union2.getResult(true, null);
-    assertEquals((int)cSk.getEstimate(), (3*k)/2);
+    assertEquals((int)cSk.getEstimate(), 3*k/2);
 
-    int serVer = getSerializationVersion(uMem);
+    final int serVer = getSerializationVersion(uMem);
     assertEquals(serVer, 3);
   }
 
   @Test
   public void checkUtilMethods() {
-    int k = 1024;
+    final int k = 1024;
 
-    int maxUnionBytes = getMaxUnionBytes(k);
-    assertEquals((2*k*8)+32, maxUnionBytes);
+    final int maxUnionBytes = getMaxUnionBytes(k);
+    assertEquals(2*k*8+32, maxUnionBytes);
 
-    int maxInterBytes = getMaxIntersectionBytes(k);
-    assertEquals((2*k*8)+24, maxInterBytes);
+    final int maxInterBytes = getMaxIntersectionBytes(k);
+    assertEquals(2*k*8+24, maxInterBytes);
 
-    int maxCompSkBytes = getMaxCompactSketchBytes(k+1);
-    assertEquals(24+((k+1)*8), maxCompSkBytes);
+    final int maxCompSkBytes = getMaxCompactSketchBytes(k+1);
+    assertEquals(24+(k+1)*8, maxCompSkBytes);
 
-    int maxSkBytes = getMaxUpdateSketchBytes(k);
-    assertEquals(24+(2*k*8), maxSkBytes);
+    final int maxSkBytes = getMaxUpdateSketchBytes(k);
+    assertEquals(24+2*k*8, maxSkBytes);
   }
 
   @Test
   public void checkStaticEstimators() {
-    int k = 4096;
-    int u = 4*k;
-    CompactSketch csk = getCompactSketch(k, 0, u);
-    Memory srcMem = getMemoryFromCompactSketch(csk);
-    double est = Sketches.getEstimate(srcMem);
+    final int k = 4096;
+    final int u = 4*k;
+    final CompactSketch csk = getCompactSketch(k, 0, u);
+    final Memory srcMem = getMemoryFromCompactSketch(csk);
+    final double est = Sketches.getEstimate(srcMem);
     assertEquals(est, u, 0.05*u);
-    double rse = 1.0/Math.sqrt(k);
-    double ub = Sketches.getUpperBound(1, srcMem);
+    final double rse = 1.0/Math.sqrt(k);
+    final double ub = Sketches.getUpperBound(1, srcMem);
     assertEquals(ub, est+rse, 0.05*u);
-    double lb = Sketches.getLowerBound(1, srcMem);
+    final double lb = Sketches.getLowerBound(1, srcMem);
     assertEquals(lb, est-rse, 0.05*u);
-    Memory memV1 = convertSerVer3toSerVer1(csk);
+    final Memory memV1 = convertSerVer3toSerVer1(csk);
     boolean empty = Sketches.getEmpty(memV1);
     assertFalse(empty);
 
-    CompactSketch csk2 = getCompactSketch(k, 0, 0);
-    Memory emptyMemV3 = getMemoryFromCompactSketch(csk2);
+    final CompactSketch csk2 = getCompactSketch(k, 0, 0);
+    final Memory emptyMemV3 = getMemoryFromCompactSketch(csk2);
     assertEquals(Sketches.getRetainedEntries(emptyMemV3), 0);
     assertEquals(Sketches.getThetaLong(emptyMemV3), Long.MAX_VALUE);
-    Memory emptyMemV1 = convertSerVer3toSerVer1(csk2);
+    final Memory emptyMemV1 = convertSerVer3toSerVer1(csk2);
     empty = Sketches.getEmpty(emptyMemV1);
     assertTrue(empty);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkBadSketchFamily() {
-    Union union = setOperationBuilder().buildUnion();
-    byte[] byteArr = union.toByteArray();
-    Memory srcMem = Memory.wrap(byteArr);
+    final Union union = setOperationBuilder().buildUnion();
+    final byte[] byteArr = union.toByteArray();
+    final Memory srcMem = Memory.wrap(byteArr);
     Sketches.getEstimate(srcMem); //Union is not a Theta Sketch, it is an operation
   }
 
@@ -189,7 +188,7 @@
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/theta/UnionImplTest.java b/src/test/java/org/apache/datasketches/theta/UnionImplTest.java
index c8e8817..8c87d8e 100644
--- a/src/test/java/org/apache/datasketches/theta/UnionImplTest.java
+++ b/src/test/java/org/apache/datasketches/theta/UnionImplTest.java
@@ -38,36 +38,36 @@
 
   @Test
   public void checkUpdateWithSketch() {
-    int k = 16;
-    WritableMemory mem = WritableMemory.wrap(new byte[(k*8) + 24]);
-    WritableMemory mem2 = WritableMemory.wrap(new byte[(k*8) + 24]);
-    UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final int k = 16;
+    final WritableMemory mem = WritableMemory.wrap(new byte[k*8 + 24]);
+    final WritableMemory mem2 = WritableMemory.wrap(new byte[k*8 + 24]);
+    final UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) { sketch.update(i); }
-    CompactSketch sketchInDirectOrd = sketch.compact(true, mem);
-    CompactSketch sketchInDirectUnord = sketch.compact(false, mem2);
-    CompactSketch sketchInHeap = sketch.compact(true, null);
+    final CompactSketch sketchInDirectOrd = sketch.compact(true, mem);
+    final CompactSketch sketchInDirectUnord = sketch.compact(false, mem2);
+    final CompactSketch sketchInHeap = sketch.compact(true, null);
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(sketchInDirectOrd);
-    union.update(sketchInHeap);
-    union.update(sketchInDirectUnord);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(sketchInDirectOrd);
+    union.union(sketchInHeap);
+    union.union(sketchInDirectUnord);
     assertEquals(union.getResult().getEstimate(), k, 0.0);
   }
 
   @Test
   public void checkUnorderedAndOrderedMemory() {
-    int k = 16;
-    WritableMemory mem = WritableMemory.wrap(new byte[(k*8) + 24]);
-    UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final int k = 16;
+    final WritableMemory mem = WritableMemory.wrap(new byte[k*8 + 24]);
+    final UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
     for (int i = 0; i < k; i++) { sketch.update(i); }
-    CompactSketch sketchInDirectOrd = sketch.compact(false, mem);
+    final CompactSketch sketchInDirectOrd = sketch.compact(false, mem);
     assertFalse(sketchInDirectOrd.isOrdered());
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(sketchInDirectOrd);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(sketchInDirectOrd);
     final double est1 = union.getResult().getEstimate();
     sketch.compact(true, mem); //change the order as a side effect
     assertTrue(sketchInDirectOrd.isOrdered());
-    union.update(sketchInDirectOrd);
+    union.union(sketchInDirectOrd);
     final double est2 = union.getResult().getEstimate();
     assertEquals(est1, est2);
     assertEquals((int)est1, k);
@@ -75,43 +75,43 @@
 
   @Test
   public void checkUpdateWithMem() {
-    int k = 16;
-    WritableMemory skMem = WritableMemory.wrap(new byte[(2*k*8) + 24]);
-    WritableMemory dirOrdCskMem = WritableMemory.wrap(new byte[(k*8) + 24]);
-    WritableMemory dirUnordCskMem = WritableMemory.wrap(new byte[(k*8) + 24]);
-    UpdateSketch udSketch = UpdateSketch.builder().setNominalEntries(k).build(skMem);
+    final int k = 16;
+    final WritableMemory skMem = WritableMemory.wrap(new byte[2*k*8 + 24]);
+    final WritableMemory dirOrdCskMem = WritableMemory.wrap(new byte[k*8 + 24]);
+    final WritableMemory dirUnordCskMem = WritableMemory.wrap(new byte[k*8 + 24]);
+    final UpdateSketch udSketch = UpdateSketch.builder().setNominalEntries(k).build(skMem);
     for (int i = 0; i < k; i++) { udSketch.update(i); } //exact
     udSketch.compact(true, dirOrdCskMem);
     udSketch.compact(false, dirUnordCskMem);
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(skMem);
-    union.update(dirOrdCskMem);
-    union.update(dirUnordCskMem);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(skMem);
+    union.union(dirOrdCskMem);
+    union.union(dirUnordCskMem);
     assertEquals(union.getResult().getEstimate(), k, 0.0);
   }
 
   @Test
   public void checkFastWrap() {
-    int k = 16;
-    long seed = DEFAULT_UPDATE_SEED;
-    int unionSize = Sketches.getMaxUnionBytes(k);
-    WritableMemory srcMem = WritableMemory.wrap(new byte[unionSize]);
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion(srcMem);
+    final int k = 16;
+    final long seed = DEFAULT_UPDATE_SEED;
+    final int unionSize = Sketches.getMaxUnionBytes(k);
+    final WritableMemory srcMem = WritableMemory.wrap(new byte[unionSize]);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion(srcMem);
     for (int i = 0; i < k; i++) { union.update(i); } //exact
     assertEquals(union.getResult().getEstimate(), k, 0.0);
-    Union union2 = UnionImpl.fastWrap(srcMem, seed);
+    final Union union2 = UnionImpl.fastWrap(srcMem, seed);
     assertEquals(union2.getResult().getEstimate(), k, 0.0);
-    Memory srcMemR = srcMem;
-    Union union3 = UnionImpl.fastWrap(srcMemR, seed);
+    final Memory srcMemR = srcMem;
+    final Union union3 = UnionImpl.fastWrap(srcMemR, seed);
     assertEquals(union3.getResult().getEstimate(), k, 0.0);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkCorruptFamilyException() {
-    int k = 16;
-    WritableMemory mem = WritableMemory.wrap(new byte[(k*8) + 24]);
-    UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final int k = 16;
+    final WritableMemory mem = WritableMemory.wrap(new byte[k*8 + 24]);
+    final UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) {
       sketch.update(i);
     }
@@ -119,77 +119,77 @@
 
     mem.putByte(PreambleUtil.FAMILY_BYTE, (byte)0); //corrupt family
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(mem);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(mem);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkVer2FamilyException() {
-    int k = 16;
-    UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final int k = 16;
+    final UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) {
       sketch.update(i);
     }
-    CompactSketch csk = sketch.compact(true, null);
-    WritableMemory v2mem = (WritableMemory) convertSerVer3toSerVer2(csk, Util.DEFAULT_UPDATE_SEED);
+    final CompactSketch csk = sketch.compact(true, null);
+    final WritableMemory v2mem = (WritableMemory) convertSerVer3toSerVer2(csk, Util.DEFAULT_UPDATE_SEED);
 
     v2mem.putByte(PreambleUtil.FAMILY_BYTE, (byte)0); //corrupt family
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(v2mem);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(v2mem);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkVer1FamilyException() {
-    int k = 16;
-    UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final int k = 16;
+    final UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
     for (int i=0; i<k; i++) {
       sketch.update(i);
     }
-    CompactSketch csk = sketch.compact(true, null);
-    WritableMemory v1mem = (WritableMemory) convertSerVer3toSerVer1(csk);
+    final CompactSketch csk = sketch.compact(true, null);
+    final WritableMemory v1mem = (WritableMemory) convertSerVer3toSerVer1(csk);
 
     v1mem.putByte(PreambleUtil.FAMILY_BYTE, (byte)0); //corrupt family
 
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(v1mem);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(v1mem);
   }
 
   @Test
   public void checkVer2EmptyHandling() {
-    int k = 16;
-    UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
-    Memory mem = convertSerVer3toSerVer2(sketch.compact(), Util.DEFAULT_UPDATE_SEED);
-    Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
-    union.update(mem);
+    final int k = 16;
+    final UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build();
+    final Memory mem = convertSerVer3toSerVer2(sketch.compact(), Util.DEFAULT_UPDATE_SEED);
+    final Union union = Sketches.setOperationBuilder().setNominalEntries(k).buildUnion();
+    union.union(mem);
   }
 
   @Test
   public void checkMoveAndResize() {
-    int k = 1 << 12;
-    int u = 2 * k;
-    int bytes = Sketches.getMaxUpdateSketchBytes(k);
+    final int k = 1 << 12;
+    final int u = 2 * k;
+    final int bytes = Sketches.getMaxUpdateSketchBytes(k);
     try (WritableDirectHandle wdh = WritableMemory.allocateDirect(bytes/2);
          WritableDirectHandle wdh2 = WritableMemory.allocateDirect(bytes/2) ) {
-      WritableMemory wmem = wdh.get();
-      UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build(wmem);
+      final WritableMemory wmem = wdh.get();
+      final UpdateSketch sketch = Sketches.updateSketchBuilder().setNominalEntries(k).build(wmem);
       assertTrue(sketch.isSameResource(wmem));
 
-      WritableMemory wmem2 = wdh2.get();
-      Union union = SetOperation.builder().buildUnion(wmem2);
+      final WritableMemory wmem2 = wdh2.get();
+      final Union union = SetOperation.builder().buildUnion(wmem2);
       assertTrue(union.isSameResource(wmem2));
 
       for (int i = 0; i < u; i++) { union.update(i); }
       assertFalse(union.isSameResource(wmem));
 
-      Union union2 = SetOperation.builder().buildUnion(); //on-heap union
+      final Union union2 = SetOperation.builder().buildUnion(); //on-heap union
       assertFalse(union2.isSameResource(wmem2));  //obviously not
     }
   }
 
   @Test
   public void checkRestricted() {
-    Union union = Sketches.setOperationBuilder().buildUnion();
+    final Union union = Sketches.setOperationBuilder().buildUnion();
     assertTrue(union.isEmpty());
     assertEquals(union.getThetaLong(), Long.MAX_VALUE);
     assertEquals(union.getSeedHash(), Util.computeSeedHash(DEFAULT_UPDATE_SEED));
@@ -199,66 +199,66 @@
 
   @Test
   public void checkUnionCompactOrderedSource() {
-    int k = 1 << 12;
-    UpdateSketch sk = Sketches.updateSketchBuilder().build();
+    final int k = 1 << 12;
+    final UpdateSketch sk = Sketches.updateSketchBuilder().build();
     for (int i = 0; i < k; i++) { sk.update(i); }
-    double est1 = sk.getEstimate();
+    final double est1 = sk.getEstimate();
 
-    int bytes = Sketches.getMaxCompactSketchBytes(sk.getRetainedEntries(true));
+    final int bytes = Sketches.getMaxCompactSketchBytes(sk.getRetainedEntries(true));
     try (WritableDirectHandle h = WritableMemory.allocateDirect(bytes)) {
-      WritableMemory wmem = h.get();
-      CompactSketch csk = sk.compact(true, wmem); //ordered, direct
-      Union union = Sketches.setOperationBuilder().buildUnion();
-      union.update(csk);
-      double est2 = union.getResult().getEstimate();
+      final WritableMemory wmem = h.get();
+      final CompactSketch csk = sk.compact(true, wmem); //ordered, direct
+      final Union union = Sketches.setOperationBuilder().buildUnion();
+      union.union(csk);
+      final double est2 = union.getResult().getEstimate();
       assertEquals(est2, est1);
     }
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkCompactFlagCorruption() {
-    int k = 1 << 12;
-    int bytes = Sketch.getMaxUpdateSketchBytes(k);
-    WritableMemory wmem1 = WritableMemory.allocate(bytes);
-    UpdateSketch sk = Sketches.updateSketchBuilder().setNominalEntries(k).build(wmem1);
+    final int k = 1 << 12;
+    final int bytes = Sketch.getMaxUpdateSketchBytes(k);
+    final WritableMemory wmem1 = WritableMemory.allocate(bytes);
+    final UpdateSketch sk = Sketches.updateSketchBuilder().setNominalEntries(k).build(wmem1);
     for (int i = 0; i < k; i++) { sk.update(i); }
     sk.compact(true, wmem1); //corrupt the wmem1 to be a compact sketch
 
-    Union union = SetOperation.builder().buildUnion();
-    union.update(sk); //update the union with the UpdateSketch object
-    CompactSketch csk1 = union.getResult();
+    final Union union = SetOperation.builder().buildUnion();
+    union.union(sk); //update the union with the UpdateSketch object
+    final CompactSketch csk1 = union.getResult();
     println(""+csk1.getEstimate());
   }
 
   @Test //checks for bug introduced in 1.0.0-incubating.
   public void checkDirectUnionSingleItem() {
-    int num = 2;
-    UpdateSketch[] skArr = new UpdateSketch[num];
+    final int num = 2;
+    final UpdateSketch[] skArr = new UpdateSketch[num];
     for (int i = 0; i < num; i++) {
       skArr[i] = new UpdateSketchBuilder().build();
     }
-    for (int i = 0; i < (num/2); i++) {
+    for (int i = 0; i < num/2; i++) {
       skArr[i].update(i);
-      skArr[i + (num/2)].update(i);
+      skArr[i + num/2].update(i);
       skArr[i].update(i + num);
     }
 
     Union union = new SetOperationBuilder().buildUnion();
     for (int i = 0; i < num; i++) {
-      union.update(skArr[i]);
+      union.union(skArr[i]);
     }
 
     CompactSketch csk = union.getResult();
     assertEquals(csk.getEstimate(), 2.0);
     //println(csk.toString(true, true, 1, true));
 
-    Memory[] memArr = new Memory[num];
+    final Memory[] memArr = new Memory[num];
     for (int i = 0; i < num; i++) {
       memArr[i] = Memory.wrap(skArr[i].compact().toByteArray());
     }
     union = new SetOperationBuilder().buildUnion();
     for (int i = 0; i < num; i++) {
-      union.update(memArr[i]);
+      union.union(memArr[i]);
     }
 
     csk = union.getResult();
@@ -274,7 +274,7 @@
   /**
    * @param o value to print
    */
-  static void println(Object o) {
+  static void println(final Object o) {
     //System.out.println(o.toString()); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/tuple/TupleExamplesTest.java b/src/test/java/org/apache/datasketches/tuple/TupleExamplesTest.java
new file mode 100644
index 0000000..c055297
--- /dev/null
+++ b/src/test/java/org/apache/datasketches/tuple/TupleExamplesTest.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.datasketches.tuple;
+
+import static org.testng.Assert.assertEquals;
+
+import org.apache.datasketches.theta.UpdateSketch;
+import org.apache.datasketches.theta.UpdateSketchBuilder;
+import org.apache.datasketches.tuple.aninteger.IntegerSummary;
+import org.apache.datasketches.tuple.aninteger.IntegerSummary.Mode;
+import org.apache.datasketches.tuple.aninteger.IntegerSummaryFactory;
+import org.apache.datasketches.tuple.aninteger.IntegerSummarySetOperations;
+import org.testng.annotations.Test;
+
+
+@SuppressWarnings("javadoc")
+public class TupleExamplesTest {
+  private final IntegerSummary.Mode umode = Mode.Sum;
+  private final IntegerSummary.Mode imode = Mode.AlwaysOne;
+  private final IntegerSummarySetOperations isso = new IntegerSummarySetOperations(umode, imode);
+  private final IntegerSummaryFactory ufactory = new IntegerSummaryFactory(umode);
+  private final IntegerSummaryFactory ifactory = new IntegerSummaryFactory(imode);
+  private final UpdateSketchBuilder thetaBldr = UpdateSketch.builder();
+  private final UpdatableSketchBuilder<Integer, IntegerSummary> tupleBldr =
+      new UpdatableSketchBuilder<>(ufactory);
+
+
+  @Test
+  public void tuple2dot0Examples() {
+    //Load source sketches
+    final UpdatableSketch<Integer, IntegerSummary> tupleSk = tupleBldr.build();
+    final UpdateSketch thetaSk = thetaBldr.build();
+    for (int i = 1; i <= 12; i++) {
+      tupleSk.update(i, 1);
+      thetaSk.update(i + 3);
+    }
+
+    //Union
+    final Union<IntegerSummary> union = new Union<>(isso);
+    union.update(tupleSk);
+    union.update(thetaSk, ufactory.newSummary().update(1));
+    final CompactSketch<IntegerSummary> ucsk = union.getResult();
+    int entries = ucsk.getRetainedEntries();
+    println("Union: " + entries);
+    final SketchIterator<IntegerSummary> uiter = ucsk.iterator();
+    int counter = 1;
+    int twos = 0;
+    int ones = 0;
+    while (uiter.next()) {
+      final int i = uiter.getSummary().getValue();
+      println(counter++ + ", " + i); //9 entries = 2, 6 entries = 1
+      if (i == 1) { ones++; }
+      if (i == 2) { twos++; }
+    }
+    assertEquals(ones, 6);
+    assertEquals(twos, 9);
+
+    //Intersection
+    final Intersection<IntegerSummary> inter = new Intersection<>(isso);
+    inter.update(tupleSk);
+    inter.update(thetaSk, ifactory.newSummary().update(1));
+    final CompactSketch<IntegerSummary> icsk = inter.getResult();
+    entries = icsk.getRetainedEntries();
+    println("Intersection: " + entries);
+    final SketchIterator<IntegerSummary> iiter = icsk.iterator();
+    counter = 1;
+    while (iiter.next()) {
+      final int i = iiter.getSummary().getValue();
+      println(counter++ + ", " + i); //9 entries = 1
+      assertEquals(i, 1);
+    }
+  }
+
+  @Test
+  public void printlnTest() {
+    println("PRINTING: "+this.getClass().getName());
+  }
+
+  /**
+   * @param s value to print
+   */
+  static void println(final String s) {
+    //System.out.println(s); //enable/disable here
+  }
+}