@Test public void testHashCode() { StringContainer c1 = new StringContainer(","); c1.addHead("a", "b", "c123"); c1.addTail("a", "12", "c"); c1.addTail("1284736", "b", "c"); StringContainer c2 = new StringContainer("."); c2.addHead("a", "b", "c123"); c2.addTail("a", "12", "c"); c2.addTail("1284736", "b", "c"); StringContainer copyC = c1.clone(); assertEquals(c1.hashCode(), copyC.hashCode()); assertNotEquals(c1.hashCode(), c2.hashCode()); StringContainer c3 = new StringContainer(","); c3.addHead("a", "b", "c123"); assertNotEquals(c1.hashCode(), c3.hashCode()); StringContainer c4 = new StringContainer(","); c4.addTail("a", "b", "c123"); assertNotEquals(c1.hashCode(), c4.hashCode()); }
@Override public int hashCode() { final int prime = 31; int result = 1; if (joinSeparator != null) { result = prime * result + joinSeparator.hashCode(); } for (String string : reverseList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } for (String string : sequenceList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } return result; }
StringContainer { @Override public int hashCode() { final int prime = 31; int result = 1; if (joinSeparator != null) { result = prime * result + joinSeparator.hashCode(); } for (String string : reverseList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } for (String string : sequenceList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } return result; } }
StringContainer { @Override public int hashCode() { final int prime = 31; int result = 1; if (joinSeparator != null) { result = prime * result + joinSeparator.hashCode(); } for (String string : reverseList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } for (String string : sequenceList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } return result; } StringContainer();  StringContainer(String joinSeparator);  StringContainer(String[] strings);  StringContainer(String[] strings, String joinSeparator); }
StringContainer { @Override public int hashCode() { final int prime = 31; int result = 1; if (joinSeparator != null) { result = prime * result + joinSeparator.hashCode(); } for (String string : reverseList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } for (String string : sequenceList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } return result; } StringContainer();  StringContainer(String joinSeparator);  StringContainer(String[] strings);  StringContainer(String[] strings, String joinSeparator); int size(); int length(); ArrayList<String> getSequenceList(); ArrayList<String> getReverseList(); StringContainer addTail(Object... objs); StringContainer addTail(String... strings); StringContainer addTail(StringContainer myContainer); StringContainer addHead(String... strings); StringContainer addHead(StringContainer myContainer); @Override String toString(); String join(String separator); String getSubString(int index); StringContainer getSubStringContainer(int start, int end); @Override int hashCode(); @Override boolean equals(Object sc); boolean equals(StringContainer sc); @Override StringContainer clone(); }
StringContainer { @Override public int hashCode() { final int prime = 31; int result = 1; if (joinSeparator != null) { result = prime * result + joinSeparator.hashCode(); } for (String string : reverseList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } for (String string : sequenceList) { result = prime * result + ((string == null) ? 0 : string.hashCode()); } return result; } StringContainer();  StringContainer(String joinSeparator);  StringContainer(String[] strings);  StringContainer(String[] strings, String joinSeparator); int size(); int length(); ArrayList<String> getSequenceList(); ArrayList<String> getReverseList(); StringContainer addTail(Object... objs); StringContainer addTail(String... strings); StringContainer addTail(StringContainer myContainer); StringContainer addHead(String... strings); StringContainer addHead(StringContainer myContainer); @Override String toString(); String join(String separator); String getSubString(int index); StringContainer getSubStringContainer(int start, int end); @Override int hashCode(); @Override boolean equals(Object sc); boolean equals(StringContainer sc); @Override StringContainer clone();  }