In the development process we often use the three mesh operator, the following two cases can you say that more reasonable?
Usage A:
...
Map<string integer> result = new hashmap<string,integer> () ...
...
Integer count = Result.get (key);
Count = = null? Result.put (key,1): Result.put (key,count++);
...
Usage B:
...
Map<string integer> result = new hashmap<string,integer> () ...
...
Integer count = Result.get (key);
Result.put (Key,count==null 1:count++);
...
At first glance, usage B is more refined, and usage a is clearer. In fact, you are wrong, usage A is wrong, do not believe you will knock the code bar, hehe.
The reason is, you may not think of it, in fact, it is very simple. The three-mesh operator has a return result, and the cause of a error is that there is less lvalue expression, which cannot be compiled at all.
Write code for years you are not also a bit dizzy, it seems that the code can not be taken for granted, or to more scrutiny.
Three-mesh operators in Java