private static DateValue[] removeDuplicates(DateValue[] dates) {
		int k = 0;
		for (int i = 1; i < dates.length; ++i) {
			if (!dates[i].equals(dates[k])) {
				dates[++k] = dates[i];
			}
		}

		if (++k < dates.length) {
			DateValue[] uniqueDates = new DateValue[k];
			System.arraycopy(dates, 0, uniqueDates, 0, k);
			return uniqueDates;
		}
		return dates;
	}
private static DateValue [ ] removeDuplicates ( DateValue [ ] dates ) { int k = 0 ; for ( int i = 1 ; i < dates . length ; ++ i ) { if ( ! dates [ i ] . equals ( dates [ k ] ) ) { dates [ ++ k ] = dates [ i ] ; } } if ( ++ k < dates . length ) { DateValue [ ] uniqueDates = new DateValue [ k ] ; System . arraycopy ( dates , 0 , uniqueDates , 0 , k ) ; return uniqueDates ; } return dates ; }
Removes duplicates from a list of date values.
@param dates the date values (must be sorted in ascending order)
@return a new array if any elements were removed or the original array if
no elements were removed