final List resultTermsList = Collections.singletonList(resultTerm);
Is this Hungarian Notation
Yes, and no.
No
No, not in the strictest sense.
Hungarian notation was a practice from the earlier days of computer programming. Tooling was weak, without sophisticated parsers that gave detailed analysis and feedback to the programmer as he/she worked. IDEs as seen today did not exist. Various languages were extremely limited, even to the point of variable names limited to extremely short lengths.
Hungarian was a way of identifying the type by indicating the data type of a variable by including a particular letter in the variable's name, as a convention.
As tooling & languages improved, the need for Hungarian notation evaporated.
So, in the strictest sense, no, your given code is not exactly following the Hungarian notation conventions.
Yes
Yes, in the more general sense.
Your given code example includes the data type, List
, as a word “list” within the name of the variable. This is similar input purpose to Hungarian notation including l
in variable name lInvTot
to mean “long integer”.
Given today's powerful editors and IDEs that can provide all kinds of realtime assistance in identifying the data type, the class, superclass, and other contextual information, including an indicator of type within the variable name is unnecessary. Such an indicator adds to verbosity without adding value. Generally this should be avoided where needless, where readability is decreased.
But context is everything. Sometimes it is sensible and justifiable to include the type in the name. For example, in an app calculating an invoice total, you may have an label, a button, a result field, an internal result number, and a method name that could all be named something like "invoiceTotal". So there it might make sense to have names such as invoiceTotalLabel
, invoiceTotalButton
, invoiceTotalField
, and invoiceTotalBigDecimal
within one area of code if clarity and readability are enhanced.