Hi Paul, hi chris, ----- Mail original ----- > De: "Chris Hegarty" <chris.hega...@oracle.com> > À: "Paul Sandoz" <paul.san...@oracle.com> > Cc: "core-libs-dev" <core-libs-dev@openjdk.java.net> > Envoyé: Jeudi 24 Septembre 2015 11:06:36 > Objet: Re: RFR 8135248: Add utility methods to check indexes and ranges > > On 24 Sep 2015, at 08:40, Paul Sandoz <paul.san...@oracle.com> wrote: > > > On 23 Sep 2015, at 18:11, Rémi Forax <fo...@univ-mlv.fr> wrote: > >>> > >>> Because i want to support the simple cases without pulling in indy. > >> > >> and what about using an anonymous class instead ? > >> > > > > Not an anonymous one, but i think i know what you mean :-)
it can be an anonymous one: private static final BiFunction<Integer, Integer, IOOBE> DEFAULT = new BiFunction<>() { ... }; anyway ... > > > > Also, i don’t want to impose a null check of the exception mapping function > > for every call, which would push the null check to when the values are out > > of bounds, and throwing an NPE in such cases seems mean when one can > > easily throw IOOBE instead. > > This does seem to be one of the rare cases where accepting null is the lesser > of two evils, given the expected usage of the API. yes, i agree, it's a kind of ugly but it seems a necessary evil. [...] > > -Chris. Rémi