Re: Inserting In a List
Wanja Gayk wrote:
Lew says...
Wanja Gayk wrote:
I do find the term "final variable" a bit clumsy though, because in my=
view these are constants. Unfortunately in the Java world, we're callin=
g
these "constants" only, if they're marked "static". Technically that's=
That is not correct Java terminology. There is nothing in the Java defin=
ition
of "constant expression" or "constant variable" that requires a static c=
ontext.
http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.28
http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.12.4
"A variable of primitive type or type String, that is final and initiali=
zed with a
compile-time constant expression (=A715.28), is called a constant variabl=
e.">
Well, Lew, I guess you pretty much understand what I mean, it's the same =
thing.
I understood you to mean that to be called a "constant" in Java that the th=
ing would
have to be static. That is not the same thing at all.
The term "constant variable" is a moronic oxymoron, it can be
Regardless of your emotional reaction to the term, that is the term.
either variable or constant. It's like saying "I have a fixed movable
The word "variable" in computer science does not mean "can vary". It means=
"a named location that can hold a value."
device" - no, you haven't, you have a fixed device, by fixing it you
have removed the "movable" nature entirely.
It's nothing like that at all.
You yourself make this clear in another post:
Wanja Gayk wrote:
"lipska the kat" says...
This is what I don't get, if it's a named bin that can be refilled why=
do you _decorate_ it with final.
It's because it is not meant to be refilled, ever, that's what you call=
a constant.
You are arguing both sides of the fence.
It does not say "final, static and ...".
I might be used to the terminology used in the Eclipse IDE when you use=
the refactoring "extract constant" you'll get a static final field.
"Extract constant" in Eclipse as a refactoring action does indeed extract t=
o a
static constant variable.
That does not mean that static variables are the only ones that can be cons=
tant.
It just means that the wizard implements the common use case.
--
Lew