You are right. That didn't occur to me. So yes, clearly, adding those 2 new methods won't add value.
-Jaikiran On Sunday, June 3, 2018, Pavel Rappo <pavel.ra...@oracle.com> wrote: > >> On 2 Jun 2018, at 07:22, Jaikiran Pai <jai.forums2...@gmail.com> wrote: >> >> Some of the places where we parse the (response) headers, we check for the presence of some headers and if not present then we default them to certain values (based on certain application specific context). In its current form of the HttpHeaders API, we would either have to write some kind of wrapper API which returns a default value for those headers or keep repeating the logic of checking the returned Optional for empty value, before defaulting it to something. > > Probably asking the obvious, but why can't you just write: > > headers.firstValue(name).orElse(defaultValue) > > instead of > > headers.firstValueOrDefault(name, defaultValue) ? > > I'm not sure the value provided by introducing these methods is worth the > increase in this API's size. Optionals provide a toolset for such tasks. > This toolset is much richer than just "defaulting". > >