<div dir="ltr"><div dir="ltr">Hello, folks!<br><br>Have a great weekend! I've been busy migrating our system from C# to the Java ecosystem (we also switched our system's host OS from Windows Server to Linux), so my responses are a bit delayed.<br><br>Thanks to Jens & Pedro for sharing. I noticed that in C#, there is an attempt to make the comparison behavior of String class/Nullable class values similar to built-in value types.<br>PS: For address comparison, the static method object::ReferenceEquals is used.<br><br>Let me modify the previous C# example:<br>```csharp<br>string s1 = new string(new char[] { '1' });<br>string s2 = new string(new char[] { '1' });<br>object o1 = s1;<br>object o2 = s1;<br><br>Console.WriteLine(s1 == s2); // True, same value<br>Console.WriteLine(object.ReferenceEquals(o1, o2)); // True, same reference<br>```<br><br>This is equivalent to the following Java example:<br>```java<br>String s1 = new String("1");<br>String s2 = new String("1");<br>Object o1 = s1;<br>Object o2 = s1;<br><br>System.out.println(s1.equals(s2)); // true, same value<br>System.out.println(o1 == o2); // true, same reference<br>```<br><br>Now that I know more, understand the history, and gradually grasp the design philosophy of Java (Thank you, Brian), I realize there are two worlds. Initially entering Java, I wasn't aware of these two worlds; I just wondered why I could use == for value comparison in the world of primitive data types, but for string comparison, I had to use String::equals.<br>At that time, I just wished that the commonly used String class could be compared by value like primitive data types.<br>C#, as a later entrant with a smaller ecosystem impact, could make adjustments to bridge the gap between these two worlds.<br>However, Java, being the pioneer, would face too high a cost to make such changes.<br><br>I now understand that Java tends to be detailed, revealing as many details as possible.<br>Object value comparison is not simple; a class can have multiple fields, and fields can be other classes. When comparing two classes' values, you can compare all fields or just a few. Additionally, Java does not support operator overloading. Overriding Object::equals to perform value comparison is reasonable.<br>I still look forward to the arrival of the era of value types mentioned by Brian, where we can use a single method for value comparison in most cases.<br><br>Thank you for your insights, John. Currently, in the Web API parameters, I use Integer to represent nullable (similar to C#'s int?), and it works well.<br><br>Lastly, let me mention a feature of C#: syntactic sugar. Honestly, after coming to the Java world, I've given up on sugar (except for var declarations). After several developments in C#, I find it challenging to understand the current version.<br>Syntactic sugar, such as extension methods and operator overloading, can be interchangeable with the original syntax. While it reduces visual burden, it hides many details, making it a cognitive burden for beginners.<br>However, I must admit that syntactic sugar has its advantages in terms of code input.<br>I plan to research how to develop an IDE plugin (I use VSCode) in my free time. This plugin will have two purposes:<br>1. In the input method, it will act like a shortcut, converting specific operators into syntactic transformations.<br>2. It will appropriately display syntactic sugar information next to the original code (I don't want to make any changes to the original code; the original code should display the most detailed details because it is the common language for everyone).<br><br>Taking the previously proposed solution C as an example:<br>```java<br>String s1 = "1";<br>String s2 = "1";<br>s1 === // After entering ===, it will automatically be converted to the following format<br>s1.equals(<br>``````<br>Another use case:<br>```java<br>BigDecimal d1 = new BigDecimal("1");<br>BigDecimal d2 = new BigDecimal("2");<br>BigDecimal d3 = new BigDecimal("0");<br>d3 = d1 + // After entering +, it will automatically be converted to the following format<br>d3 = d1.add(<br>```<br><br>Or maybe there is already such a plugin? That would be great!<br clear="all"><div><div dir="ltr" class="gmail_signature"><br></div><div dir="ltr" class="gmail_signature"><br>/* GET BETTER EVERY DAY */<br><br></div></div></div></div>