> On Nov 8, 2020, at 3:32 AM, fo...@univ-mlv.fr wrote:
> 
> It's a strawman but the effect is real, the more interfaces you have the less 
> you can reuse code because the code is written with the wrong interface for 
> your use case. 

There are points of compromise. If someone can accept misbehavior, they can use 
interfaces that are pure access interfaces, such as Iterator and Stream.

> Following the same reasoning, you can say that having interfaces saying that 
> collections are null hostile is even more important because it alleviate the 
> issue with NullPointerException. 

My own immutable collection classes are also null-intolerant. No explosion 
there. Use Optional instead.

> Array vs List is not something we can be very proud of, by example in 
> java.lang.invoke, we have several methods that are duplicated only because of 
> this dichotomy. 
> File vs Path is less an issue because it's between implementation classes, 
> not interfaces, anyway, you still have a number of methods inside 
> java.io/java.nio <http://java.io/java.nio> that are duplicated.

Progress with backwards compatibility requires some duplication. It is nothing 
to be ashamed about.

I’m more ashamed that Type<> notation cannot be used with arrays and [] 
notation cannot be used with Lists.

  Alan

Reply via email to