You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/01/27 18:42:57 UTC
(commons-lang) 01/02: Better internal names
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 3617bc18f162f7e02103ff7f94bec1facec65bdd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 26 16:58:48 2026 -0500
Better internal names
---
.../commons/lang3/builder/HashCodeBuilder.java | 54 +++++++++++-----------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
index b88b9570d..89610d298 100644
--- a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
@@ -493,19 +493,19 @@ private static void unregister(final Object value) {
/**
* Constant to use in building the hashCode.
*/
- private final int iConstant;
+ private final int constant;
/**
* Running total of the hashCode.
*/
- private int iTotal;
+ private int total;
/**
* Uses two hard coded choices for the constants needed to build a {@code hashCode}.
*/
public HashCodeBuilder() {
- iConstant = 37;
- iTotal = 17;
+ constant = 37;
+ total = 17;
}
/**
@@ -526,8 +526,8 @@ public HashCodeBuilder() {
public HashCodeBuilder(final int initialOddNumber, final int multiplierOddNumber) {
Validate.isTrue(initialOddNumber % 2 != 0, "HashCodeBuilder requires an odd initial value");
Validate.isTrue(multiplierOddNumber % 2 != 0, "HashCodeBuilder requires an odd multiplier");
- iConstant = multiplierOddNumber;
- iTotal = initialOddNumber;
+ constant = multiplierOddNumber;
+ total = initialOddNumber;
}
/**
@@ -551,7 +551,7 @@ public HashCodeBuilder(final int initialOddNumber, final int multiplierOddNumber
* @return {@code this} instance.
*/
public HashCodeBuilder append(final boolean value) {
- iTotal = iTotal * iConstant + (value ? 0 : 1);
+ total = total * constant + (value ? 0 : 1);
return this;
}
@@ -564,7 +564,7 @@ public HashCodeBuilder append(final boolean value) {
*/
public HashCodeBuilder append(final boolean[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final boolean element : array) {
append(element);
@@ -581,7 +581,7 @@ public HashCodeBuilder append(final boolean[] array) {
* @return {@code this} instance.
*/
public HashCodeBuilder append(final byte value) {
- iTotal = iTotal * iConstant + value;
+ total = total * constant + value;
return this;
}
@@ -594,7 +594,7 @@ public HashCodeBuilder append(final byte value) {
*/
public HashCodeBuilder append(final byte[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final byte element : array) {
append(element);
@@ -611,7 +611,7 @@ public HashCodeBuilder append(final byte[] array) {
* @return {@code this} instance.
*/
public HashCodeBuilder append(final char value) {
- iTotal = iTotal * iConstant + value;
+ total = total * constant + value;
return this;
}
@@ -624,7 +624,7 @@ public HashCodeBuilder append(final char value) {
*/
public HashCodeBuilder append(final char[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final char element : array) {
append(element);
@@ -653,7 +653,7 @@ public HashCodeBuilder append(final double value) {
*/
public HashCodeBuilder append(final double[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final double element : array) {
append(element);
@@ -670,7 +670,7 @@ public HashCodeBuilder append(final double[] array) {
* @return {@code this} instance.
*/
public HashCodeBuilder append(final float value) {
- iTotal = iTotal * iConstant + Float.floatToIntBits(value);
+ total = total * constant + Float.floatToIntBits(value);
return this;
}
@@ -683,7 +683,7 @@ public HashCodeBuilder append(final float value) {
*/
public HashCodeBuilder append(final float[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final float element : array) {
append(element);
@@ -700,7 +700,7 @@ public HashCodeBuilder append(final float[] array) {
* @return {@code this} instance.
*/
public HashCodeBuilder append(final int value) {
- iTotal = iTotal * iConstant + value;
+ total = total * constant + value;
return this;
}
@@ -713,7 +713,7 @@ public HashCodeBuilder append(final int value) {
*/
public HashCodeBuilder append(final int[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final int element : array) {
append(element);
@@ -734,7 +734,7 @@ public HashCodeBuilder append(final int[] array) {
// some stage. There are backwards compat issues, so
// that will have to wait for the time being. See LANG-342.
public HashCodeBuilder append(final long value) {
- iTotal = iTotal * iConstant + (int) (value ^ value >> 32);
+ total = total * constant + (int) (value ^ value >> 32);
return this;
}
@@ -747,7 +747,7 @@ public HashCodeBuilder append(final long value) {
*/
public HashCodeBuilder append(final long[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final long element : array) {
append(element);
@@ -765,13 +765,13 @@ public HashCodeBuilder append(final long[] array) {
*/
public HashCodeBuilder append(final Object object) {
if (object == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else if (ObjectUtils.isArray(object)) {
// factor out array case in order to keep method small enough
// to be inlined
appendArray(object);
} else {
- iTotal = iTotal * iConstant + object.hashCode();
+ total = total * constant + object.hashCode();
}
return this;
}
@@ -785,7 +785,7 @@ public HashCodeBuilder append(final Object object) {
*/
public HashCodeBuilder append(final Object[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final Object element : array) {
append(element);
@@ -802,7 +802,7 @@ public HashCodeBuilder append(final Object[] array) {
* @return {@code this} instance.
*/
public HashCodeBuilder append(final short value) {
- iTotal = iTotal * iConstant + value;
+ total = total * constant + value;
return this;
}
@@ -815,7 +815,7 @@ public HashCodeBuilder append(final short value) {
*/
public HashCodeBuilder append(final short[] array) {
if (array == null) {
- iTotal = iTotal * iConstant;
+ total = total * constant;
} else {
for (final short element : array) {
append(element);
@@ -864,7 +864,7 @@ private void appendArray(final Object object) {
* @since 2.0
*/
public HashCodeBuilder appendSuper(final int superHashCode) {
- iTotal = iTotal * iConstant + superHashCode;
+ total = total * constant + superHashCode;
return this;
}
@@ -893,7 +893,7 @@ public boolean equals(final Object obj) {
return false;
}
final HashCodeBuilder other = (HashCodeBuilder) obj;
- return iTotal == other.iTotal;
+ return total == other.total;
}
/**
@@ -915,7 +915,7 @@ public int hashCode() {
* @return {@code hashCode} based on the fields appended
*/
public int toHashCode() {
- return iTotal;
+ return total;
}
}