pguardiola
05/28/2017, 8:12 AMString
doesn’t complaint don’t know why but it works ¯\_(ツ)_/¯
thanks @anstaendig 👍Andreas Sinz
05/28/2017, 11:39 AMpguardiola
05/28/2017, 11:44 AMpublic static <T> PropertyValue<Function<T, String>> lineColor(Function<T, String> function) {
return new PaintPropertyValue<>("line-color", function);
}
Andreas Sinz
05/28/2017, 4:04 PMFunction<I, O>
look like?pguardiola
05/28/2017, 4:17 PMAndreas Sinz
05/28/2017, 5:11 PMpublic class Function<I, O> {
public O getPropertyValue() { }
}
public static <T> PropertyValue<Function<T, String>> lineColor(Function<T, String> function) {
return new PaintPropertyValue<>("line-color", function);
}
private fun foo(bar: Function<Any, Any>) {
lineColor(bar)
}
foo(Function<String, Int>())
The lineColor
-Method expects your Function<> to return a String on getPropertyValue
, but our bar
returns an Int.
Passing Function<String, Int>
into foo()
is perfectly fine, but passing it into lineColor
doesn't work because of the different types of O
pguardiola
05/28/2017, 5:17 PMFunction
(without specifying explicitly the generic types) because of Java's raw typesAndreas Sinz
05/28/2017, 5:19 PMpguardiola
05/28/2017, 5:21 PM