This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Check Date span Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Check Date span" Watch "Check Date span" New topic
Author

Check Date span

Farooq Ali
Ranch Hand

Joined: Sep 30, 2000
Posts: 43
Hi guys I need some help tackling a problem.
I am trying to compare different date spans and then try to coalesce them (merge them)
this is the contructor of the DateSpan class I was provided with
public DateSpan(Date start, Date end)
throws IllegalArgumentException
{
if (end.before(start)) {
throw new IllegalArgumentException("End date " + end + " is before start date "
+ start);
}
setStart(start);
setEnd(end);
}
these datespan object are then wrapped with another object and then put in a List.

Now for a certain object we can have different datspans.
If these date spans intersect or over lap I have to merge them all together and show just one DateSpan starting from earliest to the latest Date.
I would appreciate some input this
Thanks
Farooq
sfa77@yahoo.com
 
jQuery in Action, 2nd edition
 
subject: Check Date span