This following code gives me a compilation error:
public static Function<int[], Stream<Tuple2<Formatter, List<Object>>>> acquisitionColors = (col) -> Seq.of(
Tuple.tuple(Formatter.COLOR,
Seq.of(
Seq.of(col).toList(),
Seq.of(
Seq.of("Stop", "Stoq", null, "red").toList(),
Seq.of("Learning", "Learninh", null, "gray").toList(),
Seq.of("Stop", "Stoq", null, "red").toList(),
Seq.of("Reduce", "Reducf", null, "orange").toList(),
Seq.of("Keep", "Keeq", null, "green").toList(),
Seq.of("Increase", "Increasf", null, "blue").toList()
).toList()
).toList()
)
);
Wrong 2nd argument type. Found: 'java.util.List<java.util.List<? extends java.lang.Object>>', required: 'java.util.List<java.lang.Object>'
Inspection info:
tuple (Formatter,java.uti.List<java.lang.Object>) in Tuple cannot be applied
to (Formatter,java.util.List<java.util.List<? extends java.lanq.Object>>)
However, if I wrap that list with a Collections.singletonList
, it works:
public static Function<int[], Stream<Tuple2<Formatter, List<Object>>>> acquisitionColors = (col) -> Seq.of(
Tuple.tuple(Formatter.COLOR,
Collections.singletonList(
...
).toList())
)
);
Why does that happen?