@Test public void testHashCode() { Variable variable1 = new Variable(null, null, null, null, null); assertEquals(0, variable1.hashCode()); Variable variable2 = new Variable(Variable.VariableType.PROCESS); assertNotEquals(0, variable2.hashCode()); Variable variable3 = new Variable(NAME, null, DATA_TYPE, CUSTOM_DATA_TYPE, TAGS); assertEquals(1153831327, variable3.hashCode()); Variable variable4 = new Variable(null, null, null, null, new ArrayList<>()); assertEquals(0, variable4.hashCode()); }
@Override public int hashCode() { int result = getVariableType() != null ? getVariableType().hashCode() : 0; result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + (getDataType() != null ? getDataType().hashCode() : 0); result = 31 * result + (getCustomDataType() != null ? getCustomDataType().hashCode() : 0); result = 31 * result + (tags != null && !tags.isEmpty() ? tags.hashCode() : 0); return result; }
Variable { @Override public int hashCode() { int result = getVariableType() != null ? getVariableType().hashCode() : 0; result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + (getDataType() != null ? getDataType().hashCode() : 0); result = 31 * result + (getCustomDataType() != null ? getCustomDataType().hashCode() : 0); result = 31 * result + (tags != null && !tags.isEmpty() ? tags.hashCode() : 0); return result; } }
Variable { @Override public int hashCode() { int result = getVariableType() != null ? getVariableType().hashCode() : 0; result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + (getDataType() != null ? getDataType().hashCode() : 0); result = 31 * result + (getCustomDataType() != null ? getCustomDataType().hashCode() : 0); result = 31 * result + (tags != null && !tags.isEmpty() ? tags.hashCode() : 0); return result; } Variable(VariableType variableType);  Variable(final String name,
                    final VariableType variableType);  Variable(final String name,
                    final VariableType variableType,
                    final String dataType,
                    final String customDataType);  Variable(final String name,
                    final VariableType variableType,
                    final String dataType,
                    final String customDataType,
                    final List<String> tags); }
Variable { @Override public int hashCode() { int result = getVariableType() != null ? getVariableType().hashCode() : 0; result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + (getDataType() != null ? getDataType().hashCode() : 0); result = 31 * result + (getCustomDataType() != null ? getCustomDataType().hashCode() : 0); result = 31 * result + (tags != null && !tags.isEmpty() ? tags.hashCode() : 0); return result; } Variable(VariableType variableType);  Variable(final String name,
                    final VariableType variableType);  Variable(final String name,
                    final VariableType variableType,
                    final String dataType,
                    final String customDataType);  Variable(final String name,
                    final VariableType variableType,
                    final String dataType,
                    final String customDataType,
                    final List<String> tags); List<String> getTags(); void setTags(List<String> tags); VariableType getVariableType(); void setVariableType(final VariableType variableType); String getName(); void setName(final String name); String getDataType(); void setDataType(final String dataType); String getCustomDataType(); void setCustomDataType(final String customDataType); String toString(); static Variable deserialize(final String s,
                                       final VariableType variableType,
                                       final List<String> dataTypes); static Variable deserialize(final String s,
                                       final VariableType variableType); @Override boolean equals(final Object o); @Override int hashCode(); }
Variable { @Override public int hashCode() { int result = getVariableType() != null ? getVariableType().hashCode() : 0; result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + (getDataType() != null ? getDataType().hashCode() : 0); result = 31 * result + (getCustomDataType() != null ? getCustomDataType().hashCode() : 0); result = 31 * result + (tags != null && !tags.isEmpty() ? tags.hashCode() : 0); return result; } Variable(VariableType variableType);  Variable(final String name,
                    final VariableType variableType);  Variable(final String name,
                    final VariableType variableType,
                    final String dataType,
                    final String customDataType);  Variable(final String name,
                    final VariableType variableType,
                    final String dataType,
                    final String customDataType,
                    final List<String> tags); List<String> getTags(); void setTags(List<String> tags); VariableType getVariableType(); void setVariableType(final VariableType variableType); String getName(); void setName(final String name); String getDataType(); void setDataType(final String dataType); String getCustomDataType(); void setCustomDataType(final String customDataType); String toString(); static Variable deserialize(final String s,
                                       final VariableType variableType,
                                       final List<String> dataTypes); static Variable deserialize(final String s,
                                       final VariableType variableType); @Override boolean equals(final Object o); @Override int hashCode();  }