I have an entity that represents a reservation of some quantity. There will also exist entities where this property is negative indicating a lack of availability for the reservation. The logic will then decrease the quantity of a reservation with a positive quantity property value. Therefore I have this statement:
long quantityToDecrease = -reservation.getQuantity();
How can I make the unary minus stand out so that the reader of my code will be aware of it?
I went with the inline comment and empty lines around it:
// note the unary minus
long quantityToDecrease = -reservation.getQuantity();
But I also do find the solution suggested by @Kayaman appealing, because it makes the code read more like the busines logic is described.