vigna / fastutil

fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues.
Apache License 2.0
1.8k stars 197 forks source link

Deprecate the fact that shorted functors extend widened ones. #198

Closed techsy730 closed 3 years ago

techsy730 commented 3 years ago

So deprecate the fact that, for example, ByteConsumer extends java.util.function.IntConsumer.

This fact has lead to some need some unfortunate extra overloads to avoid ambiguity. These overloads were already marked deprecated, so when we remove the widened superinterface we should also remove these methods.

Example of a deprecated method that should be co-removed is ByteIterable.forEach(java.util.function.IntConsumer).

vigna commented 3 years ago

I'm confused. Why deprecate? This stuff has never been distributed AFAIK.

techsy730 commented 3 years ago

For Predicate, you are right. We could just make the change. But the Consumers were introduced in 8.0.0 it seems.

vigna commented 3 years ago

Ok. At the same time, as I was discussing in #197 , predicates and consumers are exactly the case in which implementing the JDK interface, even if the type does not match, makes perfect sense. Say you have a LongConsumer computing statistics on a stream: it is natural to use it on a CharStream. There is no unsafe type conversion. The situation is very different with operators.