Column implements Iterable<T>, Serializable { @Override public boolean equals(Object obj) { if (!(obj instanceof Column)) { return false; } Column<?> column = (Column<?>) obj; return getType().equals(column.getType()) && data.equals(column.data); } Column(Class<T> dataType, T... data);  Column(Class<T> dataType, Iterable<T> data); T get(int row); int size(); boolean isNumeric(); Class<? extends Comparable<?>> getType(); double getStatistics(String key); @Override int hashCode(); @Override boolean equals(Object obj); @Override Iterator<T> iterator();  }
@Test public void testColumnsWithIdenticalTypesAndValuesAreEqual() { Column<Integer> col1 = new Column<>(Integer.class, 1, 2, 3); Column<Integer> col2 = new Column<>(Integer.class, 1, 2, 3); boolean equal = col1.equals(col2); assertTrue(equal); }
@Test public void testColumnDoesNotEqualANonColumnObject() { Column<Integer> column = new Column<>(Integer.class, 1, 2, 3); Object someObject = new Object(); boolean equal = column.equals(someObject); assertFalse(equal); }
@Test public void testColumnsWithDifferentTypesAndIdenticalValuesAreNotEqual() { Column<Integer> col1 = new Column<>(Integer.class, 1, 2, 3); @SuppressWarnings("unchecked") Column<?> col2 = new Column(Long.class, 1, 2, 3); boolean equal = col1.equals(col2); assertFalse(equal); }
@Test public void testColumnsWithIdenticalTypesAndDifferentValuesAreNotEqual() { Column<Integer> col1 = new Column<>(Integer.class, 1, 2, 3); Column<Integer> col2 = new Column<>(Integer.class, 3, 2, 1); boolean equal = col1.equals(col2); assertFalse(equal); }