Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38665
| From | Rhino <no_offline_contact@example.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Overloading methods question |
| Date | 2018-10-26 22:10 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <pr0hef$j4u$1@dont-email.me> (permalink) |
| References | <pqqmoq$jeo$1@dont-email.me> <1b2bqd7oqzez6$.sfpve8lwmic2.dlg@40tude.net> <pqt6v0$e65$1@dont-email.me> <gqboe79efsd$.1p4kudk4cwuxl.dlg@40tude.net> |
On 2018-10-26 6:52 AM, Joerg Meier wrote: > On Thu, 25 Oct 2018 15:53:04 -0400, Rhino wrote: > >> Or did you have something different in mind? > > Basically, that is what I had in mind, although two improvements: > >> LocalDateTime ldt = LocalDateTime.now(); >> ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault()); > > LocalDateTime.now() is already returned in the system default time zone. So > you could rephrase this: > >> String fullMonthName = >> CurrentDateTimeUtils.getCurrentMonth().getDisplayName( > > as: > >> LocalDateTime.now().getMonth().getDisplayName( > > which aside of saving you from having a method is actually even shorter > than calling the method ;) > Very good! Now that I've learned more about the classes and methods available in the java.time.* classes, I've realized that I can do practically anything I need to do directly in my programs in a single line. That means it's pointless to have the vast majority of my convenience methods at all! My class of date/time methods is shrinking like an ice cube in a fry pan :-) I previously had a method to determine if a date string like "2018-10-26" met all the criteria to be a valid ISO date; it was well over 100 lines long. This is probably going to be a one liner now plus the try/catch block needed to handle any exception that I get. I *really* like the java.time.* classes! They seem very well designed, very powerful, and even concise. I'm glad Java finally developed them. Thank you - and all the others who replied - for your responses! -- Rhino
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Overloading methods question Rhino <no_offline_contact@example.com> - 2018-10-24 17:04 -0400
Re: Overloading methods question Arne Vajhøj <arne@vajhoej.dk> - 2018-10-24 18:56 -0400
Re: Overloading methods question Joerg Meier <joergmmeier@arcor.de> - 2018-10-25 10:13 +0200
Re: Overloading methods question Rhino <no_offline_contact@example.com> - 2018-10-25 15:53 -0400
Re: Overloading methods question Eric Douglas <e.d.programmer@gmail.com> - 2018-10-25 13:58 -0700
Re: Overloading methods question Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-10-25 17:49 -0400
Re: Overloading methods question Martin Gregorie <martin@mydomain.invalid> - 2018-10-25 22:29 +0000
Re: Overloading methods question Arne Vajhøj <arne@vajhoej.dk> - 2018-10-25 20:08 -0400
Re: Overloading methods question Martin Gregorie <martin@mydomain.invalid> - 2018-10-26 00:37 +0000
Re: Overloading methods question Arne Vajhøj <arne@vajhoej.dk> - 2018-10-25 21:42 -0400
Re: Overloading methods question Joerg Meier <joergmmeier@arcor.de> - 2018-10-26 12:46 +0200
Re: Overloading methods question Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-10-26 07:50 -0400
Re: Overloading methods question Martin Gregorie <martin@mydomain.invalid> - 2018-10-26 19:33 +0000
Re: Overloading methods question Eric Douglas <e.d.programmer@gmail.com> - 2018-10-26 13:13 -0700
Re: Overloading methods question Arne Vajhøj <arne@vajhoej.dk> - 2018-10-26 20:58 -0400
Re: Overloading methods question Martin Gregorie <martin@mydomain.invalid> - 2018-10-27 22:36 +0000
Re: Overloading methods question Arne Vajhøj <arne@vajhoej.dk> - 2018-10-27 19:38 -0400
Re: Overloading methods question Martin Gregorie <martin@mydomain.invalid> - 2018-10-28 10:39 +0000
Re: Overloading methods question Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-10-28 07:54 -0400
Re: Overloading methods question Eric Douglas <e.d.programmer@gmail.com> - 2018-10-26 06:26 -0700
Re: Overloading methods question Joerg Meier <joergmmeier@arcor.de> - 2018-10-26 12:52 +0200
Re: Overloading methods question Rhino <no_offline_contact@example.com> - 2018-10-26 22:10 -0400
Re: Overloading methods question Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-10-27 07:43 -0400
Re: Overloading methods question Rhino <no_offline_contact@example.com> - 2018-10-29 14:40 -0400
Re: Overloading methods question Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-10-29 16:39 -0400
Re: Overloading methods question Eric Douglas <e.d.programmer@gmail.com> - 2018-10-29 05:07 -0700
Re: Overloading methods question Rhino <no_offline_contact@example.com> - 2018-10-29 14:41 -0400
Re: Overloading methods question Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-10-25 07:49 -0400
Re: Overloading methods question Rhino <no_offline_contact@example.com> - 2018-10-25 16:07 -0400
csiph-web