Well thought out approach to the enduring null problem. This should succeed. I'll give it a try.
@chrispie511 ай бұрын
Aweseome approach. Any maven/gradle examples to play with it and see how the setup is done?
@TheBigLou1311 ай бұрын
Integer i = 0; // nullable int i = 0; // not nullable
@creamycoffee11 ай бұрын
Now do that with String.
@TheBigLou1310 ай бұрын
@@creamycoffee int is the same as char. String is the same as char array. Arrays have dynamic length and can be null. If you work with non-primitive data types like that use Optional - its made for that purpose. If you run into Optionals being null you're using them wrong: You should never receive (nullable) Optionals - instead, when you receive (nullable) non-primitive data, you can wrap them in an Optional before using them, e.g. using Optional.of(...);
@juancarlospizarromendez395411 ай бұрын
null.equals(null) gives me true; this = equal; this.equals(null) gives me true; that's a technical joke!
@TheBigLou1310 ай бұрын
null.equals() returns a NullPointerException because you're literally pointing to a null and calling a method on it. You're pointing at the absence of something and ask it to do something. That doesn't make sense. You *_can_* check if ( null == null ).
@JorgetePanete10 ай бұрын
I would love some flag like "nonullness", that without annotations makes everything non-nullable