syntactic sugar : Java Glossary
©1996-2017 2013-12-06 Roedy Green of Canadian Mind Products
AKA (Also Known As) sugar. In a computer language, there may be an abbreviation that lets
you specify something you can also specify longhand. It will not let you specify
anything new you could not do longhand. In Java the ++ and
+= operators could be considered syntactic sugar. In Java 8,
the lambda operators could be considered syntactic sugar for anonymous inner classes.
The original devisers of Java, Gosling and Joy were strongly averse to sugar. That
has been somewhat relaxed recently. It a contemptuous term for language features that
make life convenient for the application programmer, but which generate the same byte
code as previously. The JDK (Java Development Kit)
1.5+ autoboxing feature that automatically inserts
conversions back and forth between Integer and
int would be an example. The for : each loop is another example. Extreme aversion to syntactic
sugar is the programming equivalent of Puritanism.