Fastest way and Efficientiest way to find the Date withtin the Date Array

Hi all Java Expert,

I am currently writting an web application and I will retrieve couple dates within a range and put them into the Date Array Date[] by using java.util.Date. The user will input the date from screen, and I need to check whether the input Date is within that range(within the Date Array), do you guys have any good idea on that ? My way is to use a for loop to search it everytime, which I think it's stupid, however, I don't know if there are any better ways, please suggest

Transistor

[525 byte] By [popohomaa] at [2007-10-3 11:27:40]
# 1
You seem to mean that you will build a set of dates and that you need to check if another date is in the set. You can use HashSet or TreeSet for this using the method Set.contains() . No array required. No loop required.
sabre150a at 2007-7-15 13:53:48 > top of Java-index,Other Topics,Algorithms...
# 2
Date has .before() and .after() methods to allow comparison. With these you can determine if one date is after a second date and before a third date (i.e. between two dates.matfud
matfuda at 2007-7-15 13:53:48 > top of Java-index,Other Topics,Algorithms...