@Test public void testEquals() { MonthDateFormat mf1 = new MonthDateFormat(); MonthDateFormat mf2 = new MonthDateFormat(); assertEquals(mf1, mf2); assertEquals(mf2, mf1); boolean[] showYear1 = new boolean [12]; showYear1[0] = true; boolean[] showYear2 = new boolean [12]; showYear1[1] = true; mf1 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.US, 1, showYear1, new SimpleDateFormat("yy")); assertFalse(mf1.equals(mf2)); mf2 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.US, 1, showYear1, new SimpleDateFormat("yy")); assertEquals(mf1, mf2); mf1 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 1, showYear1, new SimpleDateFormat("yy")); assertFalse(mf1.equals(mf2)); mf2 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 1, showYear1, new SimpleDateFormat("yy")); assertEquals(mf1, mf2); mf1 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 2, showYear1, new SimpleDateFormat("yy")); assertFalse(mf1.equals(mf2)); mf2 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 2, showYear1, new SimpleDateFormat("yy")); assertEquals(mf1, mf2); mf1 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 2, showYear2, new SimpleDateFormat("yy")); assertFalse(mf1.equals(mf2)); mf2 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 2, showYear2, new SimpleDateFormat("yy")); assertEquals(mf1, mf2); mf1 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 2, showYear2, new SimpleDateFormat("yyyy")); assertFalse(mf1.equals(mf2)); mf2 = new MonthDateFormat(TimeZone.getTimeZone("PST"), Locale.FRANCE, 2, showYear2, new SimpleDateFormat("yyyy")); assertEquals(mf1, mf2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MonthDateFormat)) { return false; } if (!super.equals(obj)) { return false; } MonthDateFormat that = (MonthDateFormat) obj; if (!Arrays.equals(this.months, that.months)) { return false; } if (!Arrays.equals(this.showYear, that.showYear)) { return false; } if (!this.yearFormatter.equals(that.yearFormatter)) { return false; } return true; }
MonthDateFormat extends DateFormat { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MonthDateFormat)) { return false; } if (!super.equals(obj)) { return false; } MonthDateFormat that = (MonthDateFormat) obj; if (!Arrays.equals(this.months, that.months)) { return false; } if (!Arrays.equals(this.showYear, that.showYear)) { return false; } if (!this.yearFormatter.equals(that.yearFormatter)) { return false; } return true; } }
MonthDateFormat extends DateFormat { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MonthDateFormat)) { return false; } if (!super.equals(obj)) { return false; } MonthDateFormat that = (MonthDateFormat) obj; if (!Arrays.equals(this.months, that.months)) { return false; } if (!Arrays.equals(this.showYear, that.showYear)) { return false; } if (!this.yearFormatter.equals(that.yearFormatter)) { return false; } return true; } MonthDateFormat();  MonthDateFormat(TimeZone zone);  MonthDateFormat(Locale locale);  MonthDateFormat(TimeZone zone, int chars);  MonthDateFormat(Locale locale, int chars);  MonthDateFormat(TimeZone zone, Locale locale, int chars,
                           boolean showYearForJan, boolean showYearForDec);  MonthDateFormat(TimeZone zone, Locale locale, int chars,
                           boolean[] showYear, DateFormat yearFormatter); }
MonthDateFormat extends DateFormat { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MonthDateFormat)) { return false; } if (!super.equals(obj)) { return false; } MonthDateFormat that = (MonthDateFormat) obj; if (!Arrays.equals(this.months, that.months)) { return false; } if (!Arrays.equals(this.showYear, that.showYear)) { return false; } if (!this.yearFormatter.equals(that.yearFormatter)) { return false; } return true; } MonthDateFormat();  MonthDateFormat(TimeZone zone);  MonthDateFormat(Locale locale);  MonthDateFormat(TimeZone zone, int chars);  MonthDateFormat(Locale locale, int chars);  MonthDateFormat(TimeZone zone, Locale locale, int chars,
                           boolean showYearForJan, boolean showYearForDec);  MonthDateFormat(TimeZone zone, Locale locale, int chars,
                           boolean[] showYear, DateFormat yearFormatter); @Override StringBuffer format(Date date, StringBuffer toAppendTo,
                               FieldPosition fieldPosition); @Override Date parse(String source, ParsePosition pos); @Override boolean equals(Object obj); static void main(String[] args); }
MonthDateFormat extends DateFormat { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MonthDateFormat)) { return false; } if (!super.equals(obj)) { return false; } MonthDateFormat that = (MonthDateFormat) obj; if (!Arrays.equals(this.months, that.months)) { return false; } if (!Arrays.equals(this.showYear, that.showYear)) { return false; } if (!this.yearFormatter.equals(that.yearFormatter)) { return false; } return true; } MonthDateFormat();  MonthDateFormat(TimeZone zone);  MonthDateFormat(Locale locale);  MonthDateFormat(TimeZone zone, int chars);  MonthDateFormat(Locale locale, int chars);  MonthDateFormat(TimeZone zone, Locale locale, int chars,
                           boolean showYearForJan, boolean showYearForDec);  MonthDateFormat(TimeZone zone, Locale locale, int chars,
                           boolean[] showYear, DateFormat yearFormatter); @Override StringBuffer format(Date date, StringBuffer toAppendTo,
                               FieldPosition fieldPosition); @Override Date parse(String source, ParsePosition pos); @Override boolean equals(Object obj); static void main(String[] args);  }