Using only standard java 1.5 calls, I'm looking for a concise and simple way to get a java Date object for a specific time, say the next 10:30am that occurs in the future. This will generally be tomorrow at 10:30am, but it may be today at 10:30am if the current time is, say, 8am.
Efficiency is only a secondary or tertiary concern.
It seems like there must be a more graceful way to do it than manually constructing a Calendar object and setting each of its fields in a separate method call.
Using SimpleDateFormat would be fine with a format string like "HH:mm", but I don't see a clever way to get it to adjust to the next future 10:30am rather than simply today's 10:30am. Plus, those try/catch blocks are a bit tacky.
Is there really no simple one or two line way to express this?