diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingByteRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingByteRingBuffer.java index f4f2ce461a8..50a4485d522 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingByteRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingByteRingBuffer.java @@ -431,14 +431,12 @@ public byte[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); } diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingCharRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingCharRingBuffer.java index e931ba3f1c6..07e8f67a2ae 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingCharRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingCharRingBuffer.java @@ -427,14 +427,12 @@ public char[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); } diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingDoubleRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingDoubleRingBuffer.java index 516474e31ac..3ccdb24f756 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingDoubleRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingDoubleRingBuffer.java @@ -431,14 +431,12 @@ public double[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); } diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingFloatRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingFloatRingBuffer.java index fedb32a7ab5..981c7e65abb 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingFloatRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingFloatRingBuffer.java @@ -431,14 +431,12 @@ public float[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); } diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingIntRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingIntRingBuffer.java index 9794c76ec0d..b5e8d261324 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingIntRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingIntRingBuffer.java @@ -431,14 +431,12 @@ public int[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); } diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingLongRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingLongRingBuffer.java index c402fe5db2f..4863146fb39 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingLongRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingLongRingBuffer.java @@ -431,14 +431,12 @@ public long[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); } diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingObjectRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingObjectRingBuffer.java index b064b8a4383..67dca81c738 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingObjectRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingObjectRingBuffer.java @@ -431,14 +431,12 @@ public T[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); } diff --git a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingShortRingBuffer.java b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingShortRingBuffer.java index 1e6707cb473..a67a09f9c08 100644 --- a/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingShortRingBuffer.java +++ b/Base/src/main/java/io/deephaven/base/ringbuffer/AggregatingShortRingBuffer.java @@ -431,14 +431,12 @@ public short[] remove(int count) { * O(size). */ public void clear() { - final long prevHead = internalBuffer.head; - final int prevSize = size(); - internalBuffer.clear(); calcHead = calcTail = 0; + // Reset the cleared storage entries to the identity value - fillWithIdentityVal(prevHead, prevSize); + Arrays.fill(internalBuffer.storage, identityVal); // Reset the tree buffer with the identity value Arrays.fill(treeStorage, identityVal); }