On Thu, 23 Mar 2023 14:39:39 GMT, Jim Laskey <jlas...@openjdk.org> wrote:
>> Worth considering. Thank you. > > You can, of course, reduce this to; > > > interface Processor { > > ... > > static <T> StringTemplate.Processor<T, RuntimeException> > of(Function<StringTemplate, T> function) { > return function::apply; > } > > ... > > } > > var simple = Processor.of(st-> new JSONObject(st.interpolate())); > var string = Processor.of(StringTemplate::interpolate); > > > since String is just a type. This proposal has merit and worth some thought. > -2 interfaces, +1 method. On the flip side, for those that don't use `var`; Processor<JSONObject, RuntimeException> simple = Processor.of(st-> new JSONObject(st.interpolate())); Processor<String, RuntimeException> string = Processor.of(StringTemplate::interpolate); vs. SimpleProcessor<JSONObject> simple = Processor.of(st-> new JSONObject(st.interpolate())); StringProcessor string = Processor.of(StringTemplate::interpolate); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1146336461