Is there any way in Java to come up with values that are the same as null but different from normal null?

In

Java, I need a value to represent undefined (undefined state), which is used in a streaming check set, and null itself has a special meaning. I hope that the undefined / ungiven value in the flow is equivalent to null, but it can also be judged that it is different from the normal null if necessary, and if the whole process does not care about this particular value, then it should be null.

I can distinguish by a custom object, such as defining the constant public static final Object UNDEF = new String (") . When the source does not give a value, a subsequent link can easily compare the value with it with an equals sign, but the empty string may be misunderstood during a non-self-defined process. (Xxx) null has been tried, but null cannot use instanceof to determine true. So I just want to ask you if you have any suggestions?

May.07,2022

Java 8 Optional class understand


programming language has her defined purpose at the beginning of the design, so I feel that you can throw out the specific problems you encounter and study them together.
is there another way to solve your problem?
most cases can be solved by others, right?


directly define a class Undefined singleton pattern

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4206c-4496e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4206c-4496e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?