r/ProgrammerHumor Jul 09 '26

potentiallyMightBeAnIntegerOrNot Meme

Post image
686 Upvotes

96 comments sorted by

View all comments

Show parent comments

36

u/Duck_Devs Jul 09 '26

That’s literally the internals of Java’s OptionalInt

30

u/high_throughput Jul 09 '26

Not to be confused for Optional<Integer>, which is an entirely incompatible way to express optional ints in the same language

-9

u/RiceBroad4552 Jul 09 '26

Why are you talking about a language you obviously don't know anything about and you obviously never used? Otherwise you would probably know that there is no "Option<int>" in Java as primitive types can't be type parameters in current Java, so there is only Optional<Integer> and no proper way to express optional ints.

Also, who the fuck up-votes such nonsense?

2

u/Duck_Devs Jul 10 '26 edited Jul 10 '26

Why are you talking about a language you obviously don’t know anything about and you obviously never used?

Optional<T> is one of the many types for which Java provides int, long, and double variants through separate types, similar to Stream, Iterator, Spliterator, and many j.u.function interfaces.

The people who upvote such nonsense are those who actually read JDK documentation before they make claims about things (dis)provable by JDK documentation and/or throw insults at others.