StringList implements Iterable<String> { @Override public boolean equals(Object obj) { boolean result; if (this == obj) { result = true; } else if (obj instanceof StringList) { StringList tokenList = (StringList) obj; result = Arrays.equals(tokens, tokenList.tokens); } else { result = false; } return result; } StringList(String singleToken);  StringList(String... tokens); String getToken(int index); int size(); Iterator<String> iterator(); boolean compareToIgnoreCase(StringList tokens); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { assertEquals(new StringList("a", "b"), new StringList("a", "b")); assertFalse(new StringList("a", "b").equals( new StringList("A", "B"))); }