You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/12/23 00:15:56 UTC

svn commit: r1871913 [1/2] - in /poi/trunk/src: java/org/apache/poi/ddf/ java/org/apache/poi/hpsf/ java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf/record/common/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/hssf/util/ java/org/apac...

Author: kiwiwings
Date: Mon Dec 23 00:15:55 2019
New Revision: 1871913

URL: http://svn.apache.org/viewvc?rev=1871913&view=rev
Log:
Replace custom hashCode code with Objects.hash() / Arrays.deepHashCode()

Modified:
    poi/trunk/src/java/org/apache/poi/ddf/EscherComplexProperty.java
    poi/trunk/src/java/org/apache/poi/ddf/EscherSimpleProperty.java
    poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java
    poi/trunk/src/java/org/apache/poi/hpsf/Property.java
    poi/trunk/src/java/org/apache/poi/hpsf/Section.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/common/ExtRst.java
    poi/trunk/src/java/org/apache/poi/hssf/record/common/PhRun.java
    poi/trunk/src/java/org/apache/poi/hssf/record/common/UnicodeString.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
    poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
    poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
    poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw95AbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw97AbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOLVLBaseAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherComplexProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherComplexProperty.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherComplexProperty.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherComplexProperty.java Mon Dec 23 00:15:55 2019
@@ -197,7 +197,7 @@ public class EscherComplexProperty exten
 
     @Override
     public int hashCode() {
-        return getId() * 11;
+        return Arrays.deepHashCode(new Object[]{complexData, getId()});
     }
 
     @Override

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherSimpleProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherSimpleProperty.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherSimpleProperty.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherSimpleProperty.java Mon Dec 23 00:15:55 2019
@@ -18,6 +18,7 @@
 package org.apache.poi.ddf;
 
 import java.util.Map;
+import java.util.Objects;
 import java.util.function.Supplier;
 
 import org.apache.poi.util.GenericRecordUtil;
@@ -35,7 +36,7 @@ public class EscherSimpleProperty extend
     /**
      * The id is distinct from the actual property number.  The id includes the property number the blip id
      * flag and an indicator whether the property is complex or not.
-     * 
+     *
      * @param id the property id
      * @param propertyValue the property value
      */
@@ -57,7 +58,7 @@ public class EscherSimpleProperty extend
 
     /**
      * Constructs a new escher property.  The three parameters are combined to form a property id.
-     * 
+     *
      * @param propertyNumber the property number
      * @param isComplex true, if its a complex property
      * @param isBlipId true, if its a blip
@@ -142,9 +143,8 @@ public class EscherSimpleProperty extend
      * require the use of such things.
      */
     @Override
-    public int hashCode()
-    {
-        return propertyValue;
+    public int hashCode() {
+        return Objects.hash(propertyValue, getId());
     }
 
     @Override

Modified: poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java Mon Dec 23 00:15:55 2019
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hpsf;
 
+import java.util.Objects;
+
 /**
  * This class represents custom properties in the document summary
  * information stream. The difference to normal properties is that custom
@@ -39,7 +41,7 @@ public class CustomProperty extends Prop
     /**
      * Creates a {@link CustomProperty} without a name by copying the
      * underlying {@link Property}' attributes.
-     * 
+     *
      * @param property the property to copy
      */
     public CustomProperty(final Property property) {
@@ -48,7 +50,7 @@ public class CustomProperty extends Prop
 
     /**
      * Creates a {@link CustomProperty} with a name.
-     * 
+     *
      * @param property This property's attributes are copied to the new custom
      *        property.
      * @param name The new custom property's name.
@@ -81,11 +83,11 @@ public class CustomProperty extends Prop
      * Compares two custom properties for equality. The method returns
      * {@code true} if all attributes of the two custom properties are
      * equal.
-     * 
+     *
      * @param o The custom property to compare with.
      * @return {@code true} if both custom properties are equal, else
      *         {@code false}.
-     * 
+     *
      * @see java.util.AbstractSet#equals(java.lang.Object)
      */
     public boolean equalsContents(final Object o) {
@@ -108,11 +110,11 @@ public class CustomProperty extends Prop
      */
     @Override
     public int hashCode() {
-        return (int) this.getID();
+        return Objects.hash(name, getID());
     }
 
     @Override
     public boolean equals(Object o) {
-        return (o instanceof CustomProperty) ? equalsContents(o) : false;
+        return (o instanceof CustomProperty) && equalsContents(o);
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hpsf/Property.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/Property.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/Property.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/Property.java Mon Dec 23 00:15:55 2019
@@ -25,6 +25,7 @@ import java.nio.charset.Charset;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Locale;
+import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.poi.hpsf.wellknown.PropertyIDMap;
@@ -67,10 +68,10 @@ public class Property {
     /**
      * Default codepage for {@link CodePageString CodePageStrings}
      */
-    public static final int DEFAULT_CODEPAGE = CodePageUtil.CP_WINDOWS_1252; 
-    
+    public static final int DEFAULT_CODEPAGE = CodePageUtil.CP_WINDOWS_1252;
+
     private static final POILogger LOG = POILogFactory.getLogger(Property.class);
-    
+
     /** The property's ID. */
     private long id;
 
@@ -369,13 +370,7 @@ public class Property {
      */
     @Override
     public int hashCode() {
-        long hashCode = 0;
-        hashCode += id;
-        hashCode += type;
-        if (value != null) {
-            hashCode += value.hashCode();
-        }
-        return (int) (hashCode & 0x0ffffffffL );
+        return Objects.hash(id,type,value);
 
     }
 
@@ -388,7 +383,7 @@ public class Property {
     public String toString() {
         return toString(Property.DEFAULT_CODEPAGE, null);
     }
-    
+
     public String toString(int codepage, PropertyIDMap idMap) {
         final StringBuilder b = new StringBuilder();
         b.append("Property[");
@@ -419,7 +414,7 @@ public class Property {
             } catch (Exception e) {
                 LOG.log(POILogger.WARN, "can't serialize string", e);
             }
-            
+
             // skip length field
             if(bos.size() > 2*LittleEndianConsts.INT_SIZE) {
                 final String hex = HexDump.dump(bos.toByteArray(), -2*LittleEndianConsts.INT_SIZE, 2*LittleEndianConsts.INT_SIZE);
@@ -448,7 +443,7 @@ public class Property {
                 final long sec = tu.toSeconds(l);
                 l -= TimeUnit.SECONDS.toNanos(sec);
                 final long ms  = tu.toMillis(l);
-                
+
                 String str = String.format(Locale.ROOT, "%02d:%02d:%02d.%03d",hr,min,sec,ms);
                 b.append(str);
             } else {
@@ -461,7 +456,7 @@ public class Property {
             b.append("null");
         } else {
             b.append(value);
-            
+
             String decoded = decodeValueFromID();
             if (decoded != null) {
                 b.append(" (");
@@ -479,7 +474,7 @@ public class Property {
         }
         return Variant.getVariantName(getType());
     }
-    
+
     private String decodeValueFromID() {
         try {
             switch((int)getID()) {
@@ -493,7 +488,7 @@ public class Property {
         }
         return null;
     }
-    
+
     /**
      * Writes the property to an output stream.
      *

Modified: poi/trunk/src/java/org/apache/poi/hpsf/Section.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/Section.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/Section.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/Section.java Mon Dec 23 00:15:55 2019
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -219,7 +220,7 @@ public class Section {
             if (id == PropertyIDMap.PID_CODEPAGE) {
                 continue;
             }
-            
+
             int pLen = propLen(offset2Id, off, size);
             leis.setReadIndex(Math.toIntExact(this._offset + off));
 
@@ -241,7 +242,7 @@ public class Section {
                 setProperty(new Property(id, leis, pLen, codepage));
             }
         }
-        
+
         sectionBytes.write(src, Math.toIntExact(_offset), size);
         padSectionBytes();
     }
@@ -621,7 +622,7 @@ public class Section {
                 dic = PropertyIDMap.getDocumentSummaryInformationProperties();
             }
         }
-        
+
         return (dic != null && dic.containsKey(pid)) ? dic.get(pid) : PropertyIDMap.UNDEFINED;
     }
 
@@ -940,17 +941,9 @@ public class Section {
      */
     @Override
     public int hashCode() {
-        long hashCode = 0;
-        hashCode += getFormatID().hashCode();
-        final Property[] pa = getProperties();
-        for (Property aPa : pa) {
-            hashCode += aPa.hashCode();
-        }
-        return Math.toIntExact(hashCode & 0x0ffffffffL);
+        return Arrays.deepHashCode(new Object[]{getFormatID(),getProperties()});
     }
 
-
-
     /**
      * @see Object#toString()
      */
@@ -958,7 +951,7 @@ public class Section {
     public String toString() {
         return toString(null);
     }
-    
+
     public String toString(PropertyIDMap idMap) {
         final StringBuilder b = new StringBuilder();
         final Property[] pa = getProperties();

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java Mon Dec 23 00:15:55 2019
@@ -18,6 +18,8 @@
 
 package org.apache.poi.hssf.record;
 
+import java.util.Objects;
+
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.LittleEndianOutput;
@@ -1799,18 +1801,17 @@ public final class ExtendedFormatRecord
 
 	@Override
     public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + field_1_font_index;
-		result = prime * result + field_2_format_index;
-		result = prime * result + field_3_cell_options;
-		result = prime * result + field_4_alignment_options;
-		result = prime * result + field_5_indention_options;
-		result = prime * result + field_6_border_options;
-		result = prime * result + field_7_palette_options;
-		result = prime * result + field_8_adtl_palette_options;
-		result = prime * result + field_9_fill_palette_options;
-		return result;
+        return Objects.hash(
+            field_1_font_index
+            , field_2_format_index
+            , field_3_cell_options
+            , field_4_alignment_options
+            , field_5_indention_options
+            , field_6_border_options
+            , field_7_palette_options
+            , field_8_adtl_palette_options
+            , field_9_fill_palette_options
+        );
 	}
 
 	/**

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java Mon Dec 23 00:15:55 2019
@@ -458,22 +458,18 @@ public final class FontRecord extends St
 	}
 
 	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime
-				* result
-				+ ((field_11_font_name == null) ? 0 : field_11_font_name
-						.hashCode());
-		result = prime * result + field_1_font_height;
-		result = prime * result + field_2_attributes;
-		result = prime * result + field_3_color_palette_index;
-		result = prime * result + field_4_bold_weight;
-		result = prime * result + field_5_super_sub_script;
-		result = prime * result + field_6_underline;
-		result = prime * result + field_7_family;
-		result = prime * result + field_8_charset;
-		result = prime * result + field_9_zero;
-		return result;
+		return Objects.hash(
+			field_1_font_height
+			, field_2_attributes
+			, field_3_color_palette_index
+			, field_4_bold_weight
+			, field_5_super_sub_script
+			, field_6_underline
+			, field_7_family
+			, field_8_charset
+			, field_9_zero
+			, field_11_font_name
+		);
 	}
 
 	/**

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/common/ExtRst.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/common/ExtRst.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/common/ExtRst.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/common/ExtRst.java Mon Dec 23 00:15:55 2019
@@ -222,20 +222,7 @@ public class ExtRst implements Comparabl
 
     @Override
     public int hashCode() {
-        int hash = reserved;
-        hash = 31*hash+formattingFontIndex;
-        hash = 31*hash+formattingOptions;
-        hash = 31*hash+numberOfRuns;
-        hash = 31*hash+phoneticText.hashCode();
-
-        if (phRuns != null) {
-            for (PhRun ph : phRuns) {
-                hash = 31*hash+ph.phoneticTextFirstCharacterOffset;
-                hash = 31*hash+ph.realTextFirstCharacterOffset;
-                hash = 31*hash+ph.realTextLength;
-            }
-        }
-        return hash;
+        return Arrays.deepHashCode(new Object[]{reserved, formattingFontIndex, formattingOptions, numberOfRuns, phoneticText, phRuns});
     }
 
     public ExtRst copy() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/common/PhRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/common/PhRun.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/common/PhRun.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/common/PhRun.java Mon Dec 23 00:15:55 2019
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hssf.record.common;
 
+import java.util.Objects;
+
 import org.apache.poi.hssf.record.cont.ContinuableRecordOutput;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.LittleEndianInput;
@@ -52,4 +54,9 @@ public class PhRun {
         out.writeShort(realTextFirstCharacterOffset);
         out.writeShort(realTextLength);
     }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(phoneticTextFirstCharacterOffset, realTextFirstCharacterOffset, realTextLength);
+    }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/common/UnicodeString.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/common/UnicodeString.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/common/UnicodeString.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/common/UnicodeString.java Mon Dec 23 00:15:55 2019
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 import org.apache.poi.common.Duplicatable;
@@ -103,13 +104,8 @@ public class UnicodeString implements Co
         }
     }
 
-    public int hashCode()
-    {
-        int stringHash = 0;
-        if (field_3_string != null) {
-            stringHash = field_3_string.hashCode();
-        }
-        return field_1_charCount + stringHash;
+    public int hashCode() {
+        return Objects.hash(field_1_charCount, field_3_string);
     }
 
     /**

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hssf.usermodel;
 
+import java.util.Objects;
+
 import org.apache.poi.ddf.DefaultEscherRecordFactory;
 import org.apache.poi.ddf.EscherBSERecord;
 import org.apache.poi.ddf.EscherContainerRecord;
@@ -162,18 +164,18 @@ public class HSSFComment extends HSSFTex
     public boolean isVisible() {
         return _note.getFlags() == NoteRecord.NOTE_VISIBLE;
     }
-    
+
     @Override
     public CellAddress getAddress() {
         return new CellAddress(getRow(), getColumn());
     }
-    
+
     @Override
     public void setAddress(CellAddress address) {
         setRow(address.getRow());
         setColumn(address.getColumn());
     }
-    
+
     @Override
     public void setAddress(int row, int col) {
         setRow(row);
@@ -246,7 +248,7 @@ public class HSSFComment extends HSSFTex
     protected NoteRecord getNoteRecord() {
         return _note;
     }
-    
+
     /**
      * Do we know which cell this comment belongs to?
      */
@@ -288,14 +290,14 @@ public class HSSFComment extends HSSFTex
         NoteRecord note = (NoteRecord) getNoteRecord().cloneViaReserialise();
         return new HSSFComment(spContainer, obj, txo, note);
     }
-    
+
     public void setBackgroundImage(int pictureIndex){
         setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__PATTERNTEXTURE, false, true, pictureIndex));
         setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__FILLTYPE, false, false, FILL_TYPE_PICTURE));
         EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(pictureIndex);
         bse.setRef(bse.getRef() + 1);
     }
-    
+
     public void resetBackgroundImage(){
         EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.FILL__PATTERNTEXTURE);
         if (null != property){
@@ -305,7 +307,7 @@ public class HSSFComment extends HSSFTex
         }
         setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__FILLTYPE, false, false, FILL_TYPE_SOLID));
     }
-    
+
     public int getBackgroundImageId(){
         EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.FILL__PATTERNTEXTURE);
         return property == null ? 0 : property.getPropertyValue();
@@ -332,6 +334,6 @@ public class HSSFComment extends HSSFTex
 
     @Override
     public int hashCode() {
-        return ((getRow()*17) + getColumn())*31;
+        return Objects.hash(getRow(),getColumn());
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java Mon Dec 23 00:15:55 2019
@@ -17,13 +17,15 @@
 
 package org.apache.poi.hssf.usermodel;
 
+import java.util.Objects;
+
 import org.apache.poi.hssf.record.FontRecord;
 import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.ss.usermodel.Font;
 
 /**
  * Represents a Font used in a workbook.
- * 
+ *
  * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createFont()
  * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int)
  * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#setFont(HSSFFont)
@@ -207,7 +209,7 @@ public final class HSSFFont implements F
     {
         return font.getColorPaletteIndex();
     }
-    
+
     /**
      * get the color value for the font
      */
@@ -216,7 +218,7 @@ public final class HSSFFont implements F
        HSSFPalette pallette = wb.getCustomPalette();
        return pallette.getColor( getColor() );
     }
-    
+
     /**
      * sets the font to be bold or not
      */
@@ -227,7 +229,7 @@ public final class HSSFFont implements F
         else
             font.setBoldWeight(BOLDWEIGHT_NORMAL);
     }
-    
+
     /**
      * get if the font is bold or not
      */
@@ -344,11 +346,7 @@ public final class HSSFFont implements F
     }
 
 	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + ((font == null) ? 0 : font.hashCode());
-		result = prime * result + index;
-		return result;
+        return Objects.hash(font,index);
 	}
 
 	public boolean equals(Object obj) {

Modified: poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java Mon Dec 23 00:15:55 2019
@@ -22,6 +22,7 @@ import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 
 import org.apache.poi.ss.usermodel.Color;
 import org.apache.poi.util.Removal;
@@ -348,10 +349,7 @@ public class HSSFColor implements Color
 
     @Override
     public int hashCode() {
-        int result = color != null ? color.hashCode() : 0;
-        result = 31 * result + index;
-        result = 31 * result + index2;
-        return result;
+        return Objects.hash(color,index,index2);
     }
 
     /**

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java Mon Dec 23 00:15:55 2019
@@ -17,11 +17,18 @@
 
 package org.apache.poi.ss.formula;
 
-import java.text.CollationKey;
-import java.text.Collator;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
 
 import org.apache.poi.ss.formula.eval.BlankEval;
 import org.apache.poi.ss.formula.eval.BoolEval;
@@ -66,25 +73,25 @@ public class EvaluationConditionalFormat
     private final Sheet sheet;
     private final ConditionalFormatting formatting;
     private final ConditionalFormattingRule rule;
-    
+
     /* cached values */
     private final CellRangeAddress[] regions;
-    
+
     private CellRangeAddress topLeftRegion;
-    
+
     /**
      * Depending on the rule type, it may want to know about certain values in the region when evaluating {@link #matches(CellReference)},
      * such as top 10, unique, duplicate, average, etc.  This collection stores those if needed so they are not repeatedly calculated
      */
     private final Map<CellRangeAddress, Set<ValueAndFormat>> meaningfulRegionValues = new HashMap<>();
-    
+
     private final int priority;
     private final int formattingIndex;
     private final int ruleIndex;
     private final String formula1;
     private final String formula2;
     private final String text;
-    // cached for performance, used with cell text comparisons, which are case insensitive and need to be Locale aware (contains, starts with, etc.) 
+    // cached for performance, used with cell text comparisons, which are case insensitive and need to be Locale aware (contains, starts with, etc.)
     private final String lowerText;
 
     private final OperatorEnum operator;
@@ -93,7 +100,7 @@ public class EvaluationConditionalFormat
     private final ExcelNumberFormat numberFormat;
     // cached for performance, used to format numeric cells for string comparisons.  See Bug #61764 for explanation
     private final DecimalFormat decimalTextFormat;
-    
+
     /**
      *
      * @param workbookEvaluator
@@ -113,11 +120,11 @@ public class EvaluationConditionalFormat
         this.rule = rule;
         this.formattingIndex = formattingIndex;
         this.ruleIndex = ruleIndex;
-        
+
         this.priority = rule.getPriority();
-        
+
         this.regions = regions;
-        
+
         for (CellRangeAddress region : regions) {
             if (topLeftRegion == null) topLeftRegion = region;
             else if (region.getFirstColumn() < topLeftRegion.getFirstColumn()
@@ -127,15 +134,15 @@ public class EvaluationConditionalFormat
         }
         formula1 = rule.getFormula1();
         formula2 = rule.getFormula2();
-        
+
         text = rule.getText();
         lowerText = text == null ? null : text.toLowerCase(LocaleUtil.getUserLocale());
-        
+
         numberFormat = rule.getNumberFormat();
-        
+
         operator = OperatorEnum.values()[rule.getComparisonOperation()];
         type = rule.getConditionType();
-        
+
 //         Excel uses the stored text representation from the XML apparently, in tests done so far
         decimalTextFormat = new DecimalFormat("0", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
         decimalTextFormat.setMaximumFractionDigits(340); // DecimalFormat.DOUBLE_FRACTION_DIGITS, which is default scoped
@@ -147,91 +154,91 @@ public class EvaluationConditionalFormat
     public Sheet getSheet() {
         return sheet;
     }
-   
+
     /**
      * @return the formatting
      */
     public ConditionalFormatting getFormatting() {
         return formatting;
     }
-    
+
     /**
      * @return conditional formatting index
      */
     public int getFormattingIndex() {
         return formattingIndex;
     }
-    
+
     /**
      * @return Excel number format string to apply to matching cells, or null to keep the cell default
      */
     public ExcelNumberFormat getNumberFormat() {
         return numberFormat;
     }
-    
+
     /**
      * @return the rule
      */
     public ConditionalFormattingRule getRule() {
         return rule;
     }
-    
+
     /**
      * @return rule index
      */
     public int getRuleIndex() {
         return ruleIndex;
     }
-    
+
     /**
      * @return the regions
      */
     public CellRangeAddress[] getRegions() {
         return regions;
     }
-    
+
     /**
      * @return the priority
      */
     public int getPriority() {
         return priority;
     }
-    
+
     /**
      * @return the formula1
      */
     public String getFormula1() {
         return formula1;
     }
-    
+
     /**
      * @return the formula2
      */
     public String getFormula2() {
         return formula2;
     }
-    
+
     /**
      * @return condition text if any, or null
      */
     public String getText() {
         return text;
     }
-    
+
     /**
      * @return the operator
      */
     public OperatorEnum getOperator() {
         return operator;
     }
-    
+
     /**
      * @return the type
      */
     public ConditionType getType() {
         return type;
     }
-    
+
     /**
      * Defined as equal sheet name and formatting and rule indexes
      * @see java.lang.Object#equals(java.lang.Object)
@@ -255,7 +262,7 @@ public class EvaluationConditionalFormat
      * This can be seen by creating 4 rules applying to two different ranges and examining the XML.
      * <p>
      * HSSF priority is based on definition/persistence order.
-     * 
+     *
      * @param o
      * @return comparison based on sheet name, formatting index, and rule priority
      */
@@ -265,7 +272,7 @@ public class EvaluationConditionalFormat
         if (cmp != 0) {
             return cmp;
         }
-        
+
         final int x = getPriority();
         final int y = o.getPriority();
         // logic from Integer.compare()
@@ -280,15 +287,12 @@ public class EvaluationConditionalFormat
         }
         return Integer.compare(getRuleIndex(), o.getRuleIndex());
     }
-    
+
     @Override
     public int hashCode() {
-        int hash = sheet.getSheetName().hashCode();
-        hash = 31 * hash + formattingIndex;
-        hash = 31 * hash + ruleIndex;
-        return hash;
+        return Objects.hash(sheet.getSheetName(),formattingIndex,ruleIndex);
     }
-    
+
     /**
      * @param ref
      * @return true if this rule evaluates to true for the given cell
@@ -302,28 +306,28 @@ public class EvaluationConditionalFormat
                 break;
             }
         }
-        
+
         if (region == null) {
             // cell not in range of this rule
             return false;
         }
-        
+
         final ConditionType ruleType = getRule().getConditionType();
-        
+
         // these rules apply to all cells in a region. Specific condition criteria
         // may specify no special formatting for that value partition, but that's display logic
         if (ruleType.equals(ConditionType.COLOR_SCALE)
             || ruleType.equals(ConditionType.DATA_BAR)
             || ruleType.equals(ConditionType.ICON_SET)) {
-           return true; 
+           return true;
         }
-        
+
         Cell cell = null;
         final Row row = sheet.getRow(ref.getRow());
         if (row != null) {
             cell = row.getCell(ref.getCol());
         }
-        
+
         if (ruleType.equals(ConditionType.CELL_VALUE_IS)) {
             // undefined cells never match a VALUE_IS condition
             if (cell == null) return false;
@@ -335,11 +339,11 @@ public class EvaluationConditionalFormat
         if (ruleType.equals(ConditionType.FILTER)) {
             return checkFilter(cell, ref, topLeftRegion);
         }
-        
+
         // TODO: anything else, we don't handle yet, such as top 10
         return false;
     }
-    
+
     /**
      * @param cell the cell to check for
      * @param region for adjusting relative formulas
@@ -347,48 +351,48 @@ public class EvaluationConditionalFormat
      */
     private boolean checkValue(Cell cell, CellRangeAddress region) {
         if (cell == null || DataValidationEvaluator.isType(cell, CellType.BLANK)
-           || DataValidationEvaluator.isType(cell,CellType.ERROR) 
-           || (DataValidationEvaluator.isType(cell,CellType.STRING) 
+           || DataValidationEvaluator.isType(cell,CellType.ERROR)
+           || (DataValidationEvaluator.isType(cell,CellType.STRING)
                    && (cell.getStringCellValue() == null || cell.getStringCellValue().isEmpty())
                )
            ) {
             return false;
         }
-        
+
         ValueEval eval = unwrapEval(workbookEvaluator.evaluate(rule.getFormula1(), ConditionalFormattingEvaluator.getRef(cell), region));
-        
+
         String f2 = rule.getFormula2();
         ValueEval eval2 = BlankEval.instance;
         if (f2 != null && f2.length() > 0) {
             eval2 = unwrapEval(workbookEvaluator.evaluate(f2, ConditionalFormattingEvaluator.getRef(cell), region));
         }
-        
+
         // we assume the cell has been evaluated, and the current formula value stored
-        if (DataValidationEvaluator.isType(cell, CellType.BOOLEAN) 
-                && (eval == BlankEval.instance || eval instanceof BoolEval) 
-                && (eval2 == BlankEval.instance || eval2 instanceof BoolEval) 
+        if (DataValidationEvaluator.isType(cell, CellType.BOOLEAN)
+                && (eval == BlankEval.instance || eval instanceof BoolEval)
+                && (eval2 == BlankEval.instance || eval2 instanceof BoolEval)
            ) {
             return operator.isValid(cell.getBooleanCellValue(), eval == BlankEval.instance ? null : ((BoolEval) eval).getBooleanValue(), eval2 == BlankEval.instance ? null : ((BoolEval) eval2).getBooleanValue());
         }
-        if (DataValidationEvaluator.isType(cell, CellType.NUMERIC) 
+        if (DataValidationEvaluator.isType(cell, CellType.NUMERIC)
                 && (eval == BlankEval.instance || eval instanceof NumberEval )
-                && (eval2 == BlankEval.instance || eval2 instanceof NumberEval) 
+                && (eval2 == BlankEval.instance || eval2 instanceof NumberEval)
            ) {
             return operator.isValid(cell.getNumericCellValue(), eval == BlankEval.instance ? null : ((NumberEval) eval).getNumberValue(), eval2 == BlankEval.instance ? null : ((NumberEval) eval2).getNumberValue());
         }
         if (DataValidationEvaluator.isType(cell, CellType.STRING)
                 && (eval == BlankEval.instance || eval instanceof StringEval )
-                && (eval2 == BlankEval.instance || eval2 instanceof StringEval) 
+                && (eval2 == BlankEval.instance || eval2 instanceof StringEval)
            ) {
                 return operator.isValid(cell.getStringCellValue(), eval == BlankEval.instance ? null : ((StringEval) eval).getStringValue(), eval2 == BlankEval.instance ? null : ((StringEval) eval2).getStringValue());
         }
-        
+
         return operator.isValidForIncompatibleTypes();
     }
-    
+
     private ValueEval unwrapEval(ValueEval eval) {
         ValueEval comp = eval;
-        
+
         while (comp instanceof RefEval) {
             RefEval ref = (RefEval) comp;
             comp = ref.getInnerValueEval(ref.getFirstSheetIndex());
@@ -402,7 +406,7 @@ public class EvaluationConditionalFormat
      */
     private boolean checkFormula(CellReference ref, CellRangeAddress region) {
         ValueEval comp = unwrapEval(workbookEvaluator.evaluate(rule.getFormula1(), ref, region));
-        
+
         // Copied for now from DataValidationEvaluator.ValidationEnum.FORMULA#isValidValue()
         if (comp instanceof BlankEval) {
             return true;
@@ -420,7 +424,7 @@ public class EvaluationConditionalFormat
         }
         return false; // anything else is false, such as text
     }
-    
+
     private boolean checkFilter(Cell cell, CellReference ref, CellRangeAddress region) {
         final ConditionFilterType filterType = rule.getConditionFilterType();
         if (filterType == null) {
@@ -439,22 +443,22 @@ public class EvaluationConditionalFormat
         case TOP_10:
             // from testing, Excel only operates on numbers and dates (which are stored as numbers) in the range.
             // numbers stored as text are ignored, but numbers formatted as text are treated as numbers.
-            
+
             if (! cv.isNumber()) {
                 return false;
             }
-            
+
             return getMeaningfulValues(region, false, new ValueFunction() {
                 @Override
                 public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
                     final ConditionFilterData conf = rule.getFilterConfiguration();
-                    
+
                     if (! conf.getBottom()) {
                         allValues.sort(Collections.reverseOrder());
                     } else {
                         Collections.sort(allValues);
                     }
-                    
+
                     int limit = Math.toIntExact(conf.getRank());
                     if (conf.getPercent()) {
                         limit = allValues.size() * limit / 100;
@@ -473,9 +477,9 @@ public class EvaluationConditionalFormat
                 @Override
                 public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
                     Collections.sort(allValues);
-                    
+
                     final Set<ValueAndFormat> unique = new HashSet<>();
-                    
+
                     for (int i = 0; i < allValues.size(); i++) {
                         final ValueAndFormat v = allValues.get(i);
                         // skip this if the current value matches the next one, or is the last one and matches the previous one
@@ -486,7 +490,7 @@ public class EvaluationConditionalFormat
                         }
                         unique.add(v);
                     }
-                    
+
                     return unique;
                 }
             }).contains(cv);
@@ -497,9 +501,9 @@ public class EvaluationConditionalFormat
                 @Override
                 public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
                     Collections.sort(allValues);
-                    
+
                     final Set<ValueAndFormat> dup = new HashSet<>();
-                    
+
                     for (int i = 0; i < allValues.size(); i++) {
                         final ValueAndFormat v = allValues.get(i);
                         // skip this if the current value matches the next one, or is the last one and matches the previous one
@@ -515,7 +519,7 @@ public class EvaluationConditionalFormat
         case ABOVE_AVERAGE:
             // from testing, Excel only operates on numbers and dates (which are stored as numbers) in the range.
             // numbers stored as text are ignored, but numbers formatted as text are treated as numbers.
-            
+
             final ConditionFilterData conf = rule.getFilterConfiguration();
 
             // actually ordered, so iteration order is predictable
@@ -538,23 +542,23 @@ public class EvaluationConditionalFormat
                     return avgSet;
                 }
             }));
-            
+
             Double val = cv.isNumber() ? cv.getValue() : null;
             if (val == null) {
                 return false;
             }
-            
+
             double avg = values.get(0).value.doubleValue();
             double stdDev = values.get(1).value.doubleValue();
-            
+
             /*
              * use StdDev, aboveAverage, equalAverage to find:
              * comparison value
              * operator type
              */
-            
+
             Double comp = Double.valueOf(conf.getStdDev() > 0 ? (avg + (conf.getAboveAverage() ? 1 : -1) * stdDev * conf.getStdDev()) : avg) ;
-            
+
             final OperatorEnum op;
             if (conf.getAboveAverage()) {
                 if (conf.getEqualAverage()) {
@@ -611,11 +615,11 @@ public class EvaluationConditionalFormat
             return false;
         }
     }
-    
+
     /**
      * from testing, Excel only operates on numbers and dates (which are stored as numbers) in the range.
      * numbers stored as text are ignored, but numbers formatted as text are treated as numbers.
-     * 
+     *
      * @param region
      * @return the meaningful values in the range of cells specified
      */
@@ -624,9 +628,9 @@ public class EvaluationConditionalFormat
         if (values != null) {
             return values;
         }
-        
+
         List<ValueAndFormat> allValues = new ArrayList<>((region.getLastColumn() - region.getFirstColumn() + 1) * (region.getLastRow() - region.getFirstRow() + 1));
-        
+
         for (int r=region.getFirstRow(); r <= region.getLastRow(); r++) {
             final Row row = sheet.getRow(r);
             if (row == null) {
@@ -640,10 +644,10 @@ public class EvaluationConditionalFormat
                 }
             }
         }
-        
+
         values = func.evaluate(allValues);
         meaningfulRegionValues.put(region, values);
-        
+
         return values;
     }
 
@@ -671,7 +675,7 @@ public class EvaluationConditionalFormat
      * TODO: when we get to use Java 8, this is obviously a Lambda Function.
      */
     protected interface ValueFunction {
-        
+
         /**
          *
          * @param values
@@ -679,11 +683,11 @@ public class EvaluationConditionalFormat
          */
         Set<ValueAndFormat> evaluate(List<ValueAndFormat> values);
     }
-    
+
     /**
      * Not calling it OperatorType to avoid confusion for now with other classes.
      * Definition order matches OOXML type ID indexes.
-     * Note that this has NO_COMPARISON as the first item, unlike the similar 
+     * Note that this has NO_COMPARISON as the first item, unlike the similar
      * DataValidation operator enum. Thanks, Microsoft.
      */
     public static enum OperatorEnum {
@@ -731,7 +735,7 @@ public class EvaluationConditionalFormat
                 }
                 return cellValue.compareTo(v1) < 0 || cellValue.compareTo(v2) > 0;
             }
-            
+
             public boolean isValidForIncompatibleTypes() {
                 return true;
             }
@@ -767,7 +771,7 @@ public class EvaluationConditionalFormat
                 }
                 return cellValue.compareTo(v1) != 0;
             }
-            
+
             public boolean isValidForIncompatibleTypes() {
                 return true;
             }
@@ -833,7 +837,7 @@ public class EvaluationConditionalFormat
             }
         },
         ;
-        
+
         /**
          * Evaluates comparison using operator instance rules
          * @param cellValue won't be null, assumption is previous checks handled that
@@ -842,7 +846,7 @@ public class EvaluationConditionalFormat
          * @return true if the comparison is valid
          */
         public abstract <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2);
-        
+
         /**
          * Called when the cell and comparison values are of different data types
          * Needed for negation operators, which should return true.
@@ -852,43 +856,43 @@ public class EvaluationConditionalFormat
             return false;
         }
     }
-    
+
     /**
      * Note: this class has a natural ordering that is inconsistent with equals.
      */
     protected static class ValueAndFormat implements Comparable<ValueAndFormat> {
-        
+
         private final Double value;
         private final String string;
         private final String format;
         private final DecimalFormat decimalTextFormat;
-        
+
         public ValueAndFormat(Double value, String format, DecimalFormat df) {
             this.value = value;
             this.format = format;
             string = null;
             decimalTextFormat = df;
         }
-        
+
         public ValueAndFormat(String value, String format) {
             this.value = null;
             this.format = format;
             string = value;
             decimalTextFormat = null;
         }
-        
+
         public boolean isNumber() {
             return value != null;
         }
-        
+
         public Double getValue() {
             return value;
         }
-        
+
         public String getString() {
             return string;
         }
-        
+
         public String toString() {
             if(isNumber()) {
                 return decimalTextFormat.format(getValue().doubleValue());
@@ -896,7 +900,7 @@ public class EvaluationConditionalFormat
                 return getString();
             }
         }
-        
+
         @Override
         public boolean equals(Object obj) {
             if (!(obj instanceof ValueAndFormat)) {
@@ -907,7 +911,7 @@ public class EvaluationConditionalFormat
                     && Objects.equals(format, o.format)
                     && Objects.equals(string, o.string));
         }
-        
+
         /**
          * Note: this class has a natural ordering that is inconsistent with equals.
          * @param o
@@ -925,20 +929,20 @@ public class EvaluationConditionalFormat
             if (cmp != 0) {
                 return cmp;
             }
-            
+
             if (string == null && o.string != null) {
                 return 1;
             }
             if (o.string == null && string != null) {
                 return -1;
             }
-            
+
             return string == null ? 0 : string.compareTo(o.string);
         }
-        
+
         @Override
         public int hashCode() {
-            return (string == null ? 0 : string.hashCode()) * 37 * 37 + 37 * (value == null ? 0 : value.hashCode()) + (format == null ? 0 : format.hashCode());
+            return Objects.hash(string,value,format);
         }
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellReference.java Mon Dec 23 00:15:55 2019
@@ -20,6 +20,7 @@ package org.apache.poi.ss.util;
 import static org.apache.poi.util.StringUtil.endsWithIgnoreCase;
 
 import java.util.Locale;
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -32,11 +33,11 @@ import org.apache.poi.ss.usermodel.Cell;
  *  cell references, and POI usermodel style row=0, column=0
  *  style references. Handles sheet-based and sheet-free references
  *  as well, eg "Sheet1!A1" and "$B$72"</p>
- *  
+ *
  *  <p>Use <tt>CellReference</tt> when the concept of
  * relative/absolute does apply (such as a cell reference in a formula).
  * Use {@link CellAddress} when you want to refer to the location of a cell in a sheet
- * when the concept of relative/absolute does not apply (such as the anchor location 
+ * when the concept of relative/absolute does not apply (such as the anchor location
  * of a cell comment).
  * <tt>CellReference</tt>s have a concept of "sheet", while <tt>CellAddress</tt>es do not.</p>
  */
@@ -370,7 +371,7 @@ public class CellReference {
     private static final class CellRefParts {
         final String sheetName;
         final String rowRef;
-        final String colRef; 
+        final String colRef;
 
         private CellRefParts(String sheetName, String rowRef, String colRef) {
             this.sheetName = sheetName;
@@ -381,7 +382,7 @@ public class CellReference {
 
     /**
      * Separates the sheet name, row, and columns from a cell reference string.
-     * 
+     *
      * @param reference is a string that identifies a cell within the sheet or workbook
      * reference may not refer to a cell in an external workbook
      * reference may be absolute or relative.
@@ -584,12 +585,6 @@ public class CellReference {
 
     @Override
     public int hashCode() {
-        int result = 17;
-        result = 31 * result + _rowIndex;
-        result = 31 * result + _colIndex;
-        result = 31 * result + (_isRowAbs ? 1 : 0);
-        result = 31 * result + (_isColAbs ? 1 : 0);
-        result = 31 * result + (_sheetName == null ? 0 : _sheetName.hashCode());
-        return result;
+        return Objects.hash(_rowIndex,_colIndex,_isRowAbs,_isColAbs,_sheetName);
     }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java Mon Dec 23 00:15:55 2019
@@ -19,6 +19,7 @@ package org.apache.poi.openxml4j.opc;
 
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Objects;
 
 /**
  * A part relationship.
@@ -129,11 +130,7 @@ public final class PackageRelationship {
 
 	@Override
 	public int hashCode() {
-		return this.id.hashCode()
-                + this.relationshipType.hashCode()
-				+ (this.source == null ? 0 : this.source.hashCode())
-                + this.targetMode.hashCode()
-				+ this.targetUri.hashCode();
+		return Objects.hash(id,relationshipType,source,targetMode,targetUri);
 	}
 
 	/* Getters */

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java Mon Dec 23 00:15:55 2019
@@ -21,6 +21,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -128,9 +129,9 @@ public final class ContentType {
 		 * quoted-pair = "\" CHAR
 		 */
 
-		patternTypeSubType       = Pattern.compile("^(" + token + "+)/(" + 
+		patternTypeSubType       = Pattern.compile("^(" + token + "+)/(" +
 		                                           token + "+)$");
-		patternTypeSubTypeParams = Pattern.compile("^(" + token + "+)/(" + 
+		patternTypeSubTypeParams = Pattern.compile("^(" + token + "+)/(" +
 		                                           token + "+)(;" + parameter + ")*$");
 		patternParams            = Pattern.compile(";" + parameter);
 	}
@@ -160,7 +161,7 @@ public final class ContentType {
 		if (mMediaType.groupCount() >= 2) {
 			this.type = mMediaType.group(1);
 			this.subType = mMediaType.group(2);
-			
+
 			// Parameters
 			this.parameters = new HashMap<>();
 			// Java RegExps are unhelpful, and won't do multiple group captures
@@ -175,7 +176,7 @@ public final class ContentType {
 			// missing media type and subtype
 			this.type = "";
 			this.subType = "";
-			this.parameters = Collections.emptyMap(); 
+			this.parameters = Collections.emptyMap();
 		}
 	}
 
@@ -212,7 +213,7 @@ public final class ContentType {
 
 	@Override
 	public int hashCode() {
-		return this.toString().hashCode();
+		return Objects.hash(type,subType,parameters);
 	}
 
 	/* Getters */
@@ -234,14 +235,14 @@ public final class ContentType {
 	public String getType() {
 		return this.type;
 	}
-	
+
 	/**
 	 * Does this content type have any parameters associated with it?
 	 */
 	public boolean hasParameters() {
 	    return (parameters != null) && !parameters.isEmpty();
 	}
-	
+
 	/**
 	 * Return the parameter keys
 	 */

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java Mon Dec 23 00:15:55 2019
@@ -17,6 +17,8 @@
 
 package org.apache.poi.xssf.binary;
 
+import java.util.Objects;
+
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.Internal;
 
@@ -97,12 +99,7 @@ public class XSSFHyperlinkRecord {
 
     @Override
     public int hashCode() {
-        int result = cellRangeAddress != null ? cellRangeAddress.hashCode() : 0;
-        result = 31 * result + (relId != null ? relId.hashCode() : 0);
-        result = 31 * result + (location != null ? location.hashCode() : 0);
-        result = 31 * result + (toolTip != null ? toolTip.hashCode() : 0);
-        result = 31 * result + (display != null ? display.hashCode() : 0);
-        return result;
+        return Objects.hash(cellRangeAddress,relId,location,toolTip,display);
     }
 
     @Override

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java Mon Dec 23 00:15:55 2019
@@ -18,6 +18,7 @@
 package org.apache.poi.hslf.model.textproperties;
 
 import java.util.Map;
+import java.util.Objects;
 import java.util.function.Supplier;
 
 import org.apache.poi.common.Duplicatable;
@@ -100,11 +101,7 @@ public class HSLFTabStop implements TabS
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + position;
-        result = prime * result + ((type == null) ? 0 : type.hashCode());
-        return result;
+        return Objects.hash(position, type);
     }
 
     @Override

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java Mon Dec 23 00:15:55 2019
@@ -21,6 +21,7 @@ import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.function.Supplier;
 
 import org.apache.poi.sl.usermodel.TabStop.TabStopType;
@@ -123,7 +124,7 @@ public class HSLFTabStopPropCollection e
 
     @Override
     public int hashCode() {
-        return 31 * super.hashCode() + tabStops.hashCode();
+        return Objects.hash(super.hashCode(), tabStops);
     }
 
     @Override

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java Mon Dec 23 00:15:55 2019
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.function.Supplier;
 
 import org.apache.poi.common.Duplicatable;
@@ -334,13 +335,7 @@ public class TextPropCollection implemen
     }
 
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + charactersCovered;
-        result = prime * result + maskSpecial;
-        result = prime * result + indentLevel;
-        result = prime * result + textProps.hashCode();
-        return result;
+	    return Objects.hash(charactersCovered,maskSpecial,indentLevel,textProps);
     }
     /**
      * compares most properties apart of the covered characters length

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.BKFAbstractType;
 import org.apache.poi.util.Internal;
 
@@ -63,13 +65,8 @@ public final class BookmarkFirstDescript
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_1_ibkl;
-        result = prime * result + field_2_bkf_flags;
-        return result;
+    public int hashCode() {
+        return Objects.hash(field_1_ibkl,field_2_bkf_flags);
     }
 
     public boolean isEmpty()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.FibBaseAbstractType;
 import org.apache.poi.util.Internal;
 
@@ -25,7 +27,7 @@ import org.apache.poi.util.Internal;
  * <p>
  * Class and fields descriptions are quoted from Microsoft Office Word 97-2007
  * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format.
- * 
+ *
  * @author Andrew C. Oliver; Sergey Vladimirov; according to Microsoft Office
  *         Word 97-2007 Binary File Format Specification [*.doc] and [MS-DOC] -
  *         v20110608 Word (.doc) Binary File Format
@@ -84,22 +86,8 @@ public class FibBase extends FibBaseAbst
     @Override
     @SuppressWarnings( "deprecation" )
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_10_flags2;
-        result = prime * result + field_11_Chs;
-        result = prime * result + field_12_chsTables;
-        result = prime * result + field_13_fcMin;
-        result = prime * result + field_14_fcMac;
-        result = prime * result + field_1_wIdent;
-        result = prime * result + field_2_nFib;
-        result = prime * result + field_3_unused;
-        result = prime * result + field_4_lid;
-        result = prime * result + field_5_pnNext;
-        result = prime * result + field_6_flags1;
-        result = prime * result + field_7_nFibBack;
-        result = prime * result + field_8_lKey;
-        result = prime * result + field_9_envr;
-        return result;
+        return Objects.hash(field_1_wIdent, field_2_nFib, field_3_unused, field_4_lid, field_5_pnNext, field_6_flags1,
+            field_7_nFibBack, field_8_lKey, field_9_envr, field_10_flags2, field_11_Chs, field_12_chsTables,
+            field_13_fcMin, field_14_fcMac);
     }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.FibRgW97AbstractType;
 import org.apache.poi.util.Internal;
 
@@ -24,7 +26,7 @@ import org.apache.poi.util.Internal;
  * <p>
  * Class and fields descriptions are quoted from Microsoft Office Word 97-2007
  * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format.
- * 
+ *
  * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary
  *         File Format Specification [*.doc] and [MS-DOC] - v20110608 Word
  *         (.doc) Binary File Format
@@ -86,25 +88,10 @@ public class FibRgW97 extends FibRgW97Ab
 
     @Override
     @SuppressWarnings( "deprecation" )
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_10_reserved10;
-        result = prime * result + field_11_reserved11;
-        result = prime * result + field_12_reserved12;
-        result = prime * result + field_13_reserved13;
-        result = prime * result + field_14_lidFE;
-        result = prime * result + field_1_reserved1;
-        result = prime * result + field_2_reserved2;
-        result = prime * result + field_3_reserved3;
-        result = prime * result + field_4_reserved4;
-        result = prime * result + field_5_reserved5;
-        result = prime * result + field_6_reserved6;
-        result = prime * result + field_7_reserved7;
-        result = prime * result + field_8_reserved8;
-        result = prime * result + field_9_reserved9;
-        return result;
+    public int hashCode() {
+        return Objects.hash(field_1_reserved1, field_2_reserved2, field_3_reserved3, field_4_reserved4,
+            field_5_reserved5, field_6_reserved6, field_7_reserved7, field_8_reserved8, field_9_reserved9,
+            field_10_reserved10, field_11_reserved11, field_12_reserved12, field_13_reserved13, field_14_lidFE);
     }
 
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.FRDAbstractType;
 import org.apache.poi.util.Internal;
 
@@ -61,12 +63,8 @@ public final class FootnoteReferenceDesc
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_1_nAuto;
-        return result;
+    public int hashCode() {
+        return Objects.hash(field_1_nAuto);
     }
 
     public boolean isEmpty()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java Mon Dec 23 00:15:55 2019
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.HRESIAbstractType;
 import org.apache.poi.hwpf.usermodel.CharacterProperties;
 import org.apache.poi.util.Internal;
@@ -24,7 +26,7 @@ import org.apache.poi.util.LittleEndian;
 
 /**
  * Hyphenation. Substructure of the {@link CharacterProperties}.
- * 
+ *
  * @author Sergey Vladimirov ( vlsergey {at} gmail {dot} com )
  */
 @Internal
@@ -79,13 +81,8 @@ public final class Hyphenation extends H
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_1_hres;
-        result = prime * result + field_2_chHres;
-        return result;
+    public int hashCode() {
+        return Objects.hash(field_1_hres,field_2_chHres);
     }
 
     public boolean isEmpty()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java Mon Dec 23 00:15:55 2019
@@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndian;
 /**
  * The LFOData structure contains the Main Document CP of the corresponding LFO,
  * as well as an array of LVL override data.
- * 
+ *
  * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com)
  */
 @Internal
@@ -104,8 +104,6 @@ public class LFOData
 
     @Override
     public int hashCode() {
-        int result = _cp;
-        result = 31 * result + Arrays.hashCode(_rgLfoLvl);
-        return result;
+        return Arrays.deepHashCode(_rgLfoLvl);
     }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java Mon Dec 23 00:15:55 2019
@@ -80,7 +80,7 @@ public final class ListData
 
     /**
      * Gets the level associated to a particular List at a particular index.
-     * 
+     *
      * @param index
      *            1-based index
      * @return a list level
@@ -106,13 +106,8 @@ public final class ListData
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Arrays.hashCode( _levels );
-        result = prime * result + ( ( _lstf == null ) ? 0 : _lstf.hashCode() );
-        return result;
+    public int hashCode() {
+        return Arrays.deepHashCode(new Object[]{_levels,_lstf});
     }
 
     public int numLevels()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.util.Internal;
 
 /**
@@ -81,13 +83,8 @@ public final class ListFormatOverrideLev
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + _base.hashCode();
-        result = prime * result + ( _lvl != null ? _lvl.hashCode() : 0 );
-        return result;
+    public int hashCode() {
+        return Objects.hash(_base,_lvl);
     }
 
     public boolean isFormatting()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java Mon Dec 23 00:15:55 2019
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.LinkedHashMap;
 import java.util.NoSuchElementException;
+import java.util.Objects;
 
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.LittleEndian;
@@ -162,13 +163,8 @@ public final class ListTables
   }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + _listMap.hashCode();
-        result = prime * result + ( ( _plfLfo == null ) ? 0 : _plfLfo.hashCode() );
-        return result;
+    public int hashCode() {
+        return Objects.hash(_listMap,_plfLfo);
     }
 
     @Override

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java Mon Dec 23 00:15:55 2019
@@ -27,7 +27,7 @@ import org.apache.poi.util.Internal;
  * <p>
  * Class and fields descriptions are quoted from Microsoft Office Word 97-2007
  * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
- * 
+ *
  * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com)
  */
 @Internal
@@ -111,38 +111,12 @@ public class PICF extends PICFAbstractTy
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_10_padding2;
-        result = prime * result + field_11_dxaGoal;
-        result = prime * result + field_12_dyaGoal;
-        result = prime * result + field_13_mx;
-        result = prime * result + field_14_my;
-        result = prime * result + field_15_dxaReserved1;
-        result = prime * result + field_16_dyaReserved1;
-        result = prime * result + field_17_dxaReserved2;
-        result = prime * result + field_18_dyaReserved2;
-        result = prime * result + field_19_fReserved;
-        result = prime * result + field_1_lcb;
-        result = prime * result + field_20_bpp;
-        result = prime * result + Arrays.hashCode( field_21_brcTop80 );
-        result = prime * result + Arrays.hashCode( field_22_brcLeft80 );
-        result = prime * result + Arrays.hashCode( field_23_brcBottom80 );
-        result = prime * result + Arrays.hashCode( field_24_brcRight80 );
-        result = prime * result + field_25_dxaReserved3;
-        result = prime * result + field_26_dyaReserved3;
-        result = prime * result + field_27_cProps;
-        result = prime * result + field_2_cbHeader;
-        result = prime * result + field_3_mm;
-        result = prime * result + field_4_xExt;
-        result = prime * result + field_5_yExt;
-        result = prime * result + field_6_swHMF;
-        result = prime * result + field_7_grf;
-        result = prime * result + field_8_padding;
-        result = prime * result + field_9_mmPM;
-        return result;
+    public int hashCode() {
+        return Arrays.deepHashCode(new Object[]{field_1_lcb, field_2_cbHeader, field_3_mm, field_4_xExt, field_5_yExt,
+            field_6_swHMF, field_7_grf, field_8_padding, field_9_mmPM, field_10_padding2, field_11_dxaGoal,
+            field_12_dyaGoal, field_13_mx, field_14_my, field_15_dxaReserved1, field_16_dyaReserved1, field_17_dxaReserved2,
+            field_18_dyaReserved2, field_19_fReserved, field_20_bpp, field_21_brcTop80, field_22_brcLeft80,
+            field_23_brcBottom80, field_24_brcRight80, field_25_dxaReserved3, field_26_dyaReserved3, field_27_cProps});
     }
 
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java Mon Dec 23 00:15:55 2019
@@ -18,6 +18,7 @@
 package org.apache.poi.hwpf.model;
 
 import java.nio.charset.Charset;
+import java.util.Objects;
 
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.LittleEndian;
@@ -89,12 +90,7 @@ public final class PieceDescriptor {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + descriptor;
-        result = prime * result + ( ( prm == null ) ? 0 : prm.hashCode() );
-        result = prime * result + ( unicode ? 1231 : 1237 );
-        return result;
+        return Objects.hash(descriptor,prm,unicode);
     }
 
     /**

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java Mon Dec 23 00:15:55 2019
@@ -32,7 +32,7 @@ import org.apache.poi.util.POILogger;
  * <p>
  * Documentation quoted from Page 424 of 621. [MS-DOC] -- v20110315 Word (.doc)
  * Binary File Format
- * 
+ *
  * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com)
  */
 public class PlfLfo
@@ -49,7 +49,7 @@ public class PlfLfo
 
     private LFOData[] _rgLfoData;
 
-    
+
     PlfLfo( byte[] tableStream, int fcPlfLfo, int lcbPlfLfo )
     {
         /*
@@ -192,14 +192,8 @@ public class PlfLfo
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + _lfoMac;
-        result = prime * result + Arrays.hashCode( _rgLfo );
-        result = prime * result + Arrays.hashCode( _rgLfoData );
-        return result;
+    public int hashCode() {
+        return Arrays.deepHashCode(new Object[]{_lfoMac, _rgLfo, _rgLfoData});
     }
 
     void writeTo( FileInformationBlock fib, ByteArrayOutputStream outputStream )

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.Internal;
 
@@ -103,12 +105,8 @@ public final class PropertyModifier impl
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + value;
-        return result;
+    public int hashCode() {
+        return Objects.hash(value);
     }
 
     public boolean isComplex()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java Mon Dec 23 00:15:55 2019
@@ -19,6 +19,7 @@ package org.apache.poi.hwpf.model;
 
 import java.util.Arrays;
 import java.util.Comparator;
+import java.util.Objects;
 
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.POILogFactory;
@@ -147,7 +148,7 @@ public abstract class PropertyNode<T ext
 
     @Override
     public int hashCode() {
-        return this._cpStart * 31 + this._buf.hashCode();
+        return Objects.hash(_cpStart,_buf);
     }
 
     public boolean equals(Object o) {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java Mon Dec 23 00:15:55 2019
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.util.Internal;
 
 
@@ -67,12 +69,8 @@ public final class SavedByEntry
    *
    * @return the hash code.
    */
-  public int hashCode()
-  {
-    int hash = 29;
-    hash = hash * 13 + userName.hashCode();
-    hash = hash * 13 + saveLocation.hashCode();
-    return hash;
+  public int hashCode() {
+    return Objects.hash(userName,saveLocation);
   }
 
   /**

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.StdfBaseAbstractType;
 import org.apache.poi.util.Internal;
 
@@ -59,16 +61,8 @@ class StdfBase extends StdfBaseAbstractT
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_1_info1;
-        result = prime * result + field_2_info2;
-        result = prime * result + field_3_info3;
-        result = prime * result + field_4_bchUpe;
-        result = prime * result + field_5_grfstd;
-        return result;
+    public int hashCode() {
+        return Objects.hash(field_1_info1, field_2_info2, field_3_info3, field_4_bchUpe, field_5_grfstd);
     }
 
     public byte[] serialize()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.StdfPost2000AbstractType;
 import org.apache.poi.util.Internal;
 
@@ -55,15 +57,8 @@ class StdfPost2000 extends StdfPost2000A
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_1_info1;
-        result = prime * result
-                + (int) ( field_2_rsid ^ ( field_2_rsid >>> 32 ) );
-        result = prime * result + field_3_info3;
-        return result;
+    public int hashCode() {
+        return Objects.hash(field_1_info1, field_2_rsid, field_3_info3);
     }
 
     public byte[] serialize()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java Mon Dec 23 00:15:55 2019
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.hwpf.model;
 
+import java.util.Objects;
+
 import org.apache.poi.hwpf.model.types.StshifAbstractType;
 import org.apache.poi.util.Internal;
 
@@ -67,20 +69,9 @@ class Stshif extends StshifAbstractType
     }
 
     @Override
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + field_1_cstd;
-        result = prime * result + field_2_cbSTDBaseInFile;
-        result = prime * result + field_3_info3;
-        result = prime * result + field_4_stiMaxWhenSaved;
-        result = prime * result + field_5_istdMaxFixedWhenSaved;
-        result = prime * result + field_6_nVerBuiltInNamesWhenSaved;
-        result = prime * result + field_7_ftcAsci;
-        result = prime * result + field_8_ftcFE;
-        result = prime * result + field_9_ftcOther;
-        return result;
+    public int hashCode() {
+        return Objects.hash(field_1_cstd, field_2_cbSTDBaseInFile, field_3_info3, field_4_stiMaxWhenSaved,
+            field_5_istdMaxFixedWhenSaved, field_6_nVerBuiltInNamesWhenSaved, field_7_ftcAsci, field_8_ftcFE, field_9_ftcOther);
     }
 
     public byte[] serialize()

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java Mon Dec 23 00:15:55 2019
@@ -220,13 +220,7 @@ public final class StyleDescription {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((_name == null) ? 0 : _name.hashCode());
-        result = prime * result
-                + ((_stdfBase == null) ? 0 : _stdfBase.hashCode());
-        result = prime * result + Arrays.hashCode(_upxs);
-        return result;
+        return Arrays.deepHashCode(new Object[]{_name,_stdfBase,_upxs});
     }
 
     @Override

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java?rev=1871913&r1=1871912&r2=1871913&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java Mon Dec 23 00:15:55 2019
@@ -316,7 +316,7 @@ public class TextPieceTable implements C
 
     @Override
     public int hashCode() {
-        return _textPieces.size();
+        return _textPieces.hashCode();
     }
 
     public boolean isIndexInTable(int bytePos) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org