This question already has an answer here:
- Untyped functions in static languages 4 answers
This Java answer (and this one) uses a lambda that does not explicitly declare its parameter type, but this Scala answer includes a parameter type. in both cases, the type could be inferred when it is assigned to a variable. For example, for a lambda that takes an int and returns an int:
Function<Integer, Integer> f = a->... // Java
val f: Int => Int = a=>... // Scala
My question is: should the type parameters be included in the lambda, or can we assume that they are declared as above?