@Test public void testEquals() { Language langA = new Language("langA"); Language langB = new Language("langB"); Language langA5 = new Language("langA5", 5.0); Language langA6 = new Language("langA5", 6.0); Assert.assertEquals(langA, langA); Assert.assertEquals(langA5, langA5); Assert.assertNotEquals(langA, langA5); Assert.assertNotEquals(langA, langB); Assert.assertEquals(langA6, langA5); Assert.assertNotEquals(langA, "something else"); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Language) { Language a = (Language) obj; return getLang().equals(a.getLang()); } return false; }
Language implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Language) { Language a = (Language) obj; return getLang().equals(a.getLang()); } return false; } }
Language implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Language) { Language a = (Language) obj; return getLang().equals(a.getLang()); } return false; } Language(String lang);  Language(String lang, double confidence); }
Language implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Language) { Language a = (Language) obj; return getLang().equals(a.getLang()); } return false; } Language(String lang);  Language(String lang, double confidence); String getLang(); double getConfidence(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
Language implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Language) { Language a = (Language) obj; return getLang().equals(a.getLang()); } return false; } Language(String lang);  Language(String lang, double confidence); String getLang(); double getConfidence(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }