« first day (1945 days earlier)      last day (3010 days later) » 
00:00 - 21:0021:00 - 00:00

9:00 PM
It's almost FUCK THIS SHIT O'Clock.
5
 
List<int> a is this correct?
List<int> a,
 
fge
@user3623498 it isn't
It will be in the future; but right now it isn't
 
hmmm... why so?
 
No
 
@ballBreaker Treating me pretty well.
 
9:03 PM
You can't define a Generic with a primitive (int is primitive)
you can do this:
List<Integer>
 
ooo
I see
thx :)
 
I wish I could have a drink
 
@Kylar AGREED
 
fge
@user3623498 because generics specialization (aka project Valhalla) is not scheduled until at least Java 9
When it's done, then yes, you'll be able to have a List<int>
But right now you can't
 
hhehehe... if I'll have this question tomorrow I'll answer that :))
 
fge
9:05 PM
Although you can test bleeding edge code implementing that
@user3623498 if you are interested you may want to start here
I have been interested in the subject for some time
Along with JSR 292
 
it's fine... thx :P
 
@fge one could argue that if he doesn't know why List<int> doesn't work, perhaps he should avoid bleeding edge right now. We wouldn't want him to bleed TO DEATH
 
fge
Yeah, there is that
Anyway, currently, type parameters can not be primitive types
So no List<int> for you
By the way, this very limitation is why you have IntStream, DoubleStream, LongStream
 
9:43 PM
B extends A
so if I have List<A> a, and List<B> b, is a=b correct?
 
no
you should have List<? extends A> a
in order of this to work
be cause List<A> doesn't extends List<B>
 
I see... thx
:)
Double[] x;
x.lenght() = 0 ??
 
i don't think so because x is not initialized yet this wont be compiled i think
javac will tell you that expression i not initialized
 
@user3623498 what even is that?
 
9:50 PM
That's like doing null = 0
You can't assign a value to a value
 
i thought it was ==
 
== is comparing an object to an other
 
yes
 
fge
@Gemtastic rather, talk about the limitations about lvalues in assignments, that is more technically correct :p
 
object.value.equals(0) compares the value
 
9:53 PM
== works for primitive types and there wrappers as equal
 
is not asigning, sorry, checking
==
my bad :/
 
x.length() == 0 compares if the memory address for the result/return of the method. With primitives, they are the same so it "works"
 
fge
@achabahe == also works for object references
 
yes
 
fge
@Gemtastic waaat?
OK, let us be clear here, shall we?
== works in two contexts: primitive equality and object reference equality
 
9:55 PM
@fge That's what I'm getting at
 
yes @fge
 
fge
If none of these apply then it means that you have two objects, and if you want to test equality between both, Object has .equals() for this purpose
 
i m totally with i don't disagree with @Gemtastic
with you*
 
fge
But there is no such thing as comparing "memory addresses" in Java
 
The object reference is a memory address
 
9:57 PM
yes it is in C
 
fge
Except if you happen to use System.identityHashCode() or ==, but that is just a side effect
@Gemtastic no; that is where you are wrong
It is only an object reference as viewed by the JVM implementation
 
Oh, then educate me the difference between the memory address and object reference.
The JVM implementation still holds a memory address for the object
 
fge
It is the JVM implementation which decides whether two object references are the same
 
>_>
 
fge
NOTHING in the Java language specification ever requires that two object references being equal implies that they share the same address in memeory
 
9:59 PM
the memory a is like what you have in C when you are holding a pointer you can have a walk in the memory by incrementing the pointer but in java it is just a refernce that jvm gives you to manipulate you objects
 
fge
It is just a side effect of implementations, because it is indeed the logical way to implement it
That is all there is to it
 
I was taught the opposite; the object reference points to a memory spot where the object is and when the reference is the same they point to the same object in the memory.
 
fge
Well, you have been taught the reverse of what you should have been taught :p
 
I'd be happy if you could provide som sources so that I can read about it
 
fge
The JLS
That is the source
 
10:02 PM
@fge can you have two objects that have same reference but point to diferent objects
 
fge
@achabahe no you can't; but again, what is a reference?
 
so a reference like some address in JVM and not memory is that what you are trying to say
 
fge
No, what I mean is that a reference is an abstract notion by the JVM address for which only the JVM decides whether two references are the same or not
It just happens that the logical implementation of that is that they point to the same memory content
Nothing, in theory, REQUIRES that they point to the same memory content
Yes, call me pedantic all you want; I don't care, I just know that == in Java works like it is supposed to work. I just don't extrapolate a possible implementation and say "that is how it is done" unless it is documented to be how it's done, is all :p
 
bye guys, and thank you for all the help given
 
the confusion comes from the fact that reference is the only way to access that content in memory that's way people confuses it with memory address
 
fge
10:09 PM
@achabahe remove "in memory" from that sentence and you'll have it pretty much nailed down
 
ok @feg hhhhhh
i think you are right because java is VM so our code get executed but some engin of java further more all access to memory is managed by java and if the java can't allocate memmory it raises OutOfMemoryError
 
If it's not in memory, then where is it?
 
fge
@Gemtastic you haven't read correctly; this is not a question of being in memory or not
It will be
But at the exact same location? Nothing guarantees that
Nothing guarantees that if you have two references a and b in java, then a == b implies that a and b lie at exactly the same place
 
I just don't understand how removing "in memory" changes anything apart from hinting that objects are stored in magical poofs
 
fge
== is just an operation defined by the JVM which guarantees a certain contract
 
10:23 PM
That's never been a question though
Also that statement can be applied to everything
 
fge
It wasn't, but that was the conclusion you brought
 
No it was not
 
fge
Which is wrong, logically speaking
You did
Ah well
 
MY POINT was that it compares object references to each other
 
fge
Nevermind, I'm done with that
Yes, from which you extrapolated that "they lie in the same place in memory"
It is that extrapolation that I was referring to
 
10:29 PM
Yes yess, here have a cookie
 
fge
I'll have it; in exchange I offer you a reality check :p
 
I'll let you keep it, you need it more than I do
 
fge
What you said is exactly the reverse of the situation :p
But I'm used to it, so I'll let it pass
 
Then you didn't read what I wrote
 
fge
> x.length() == 0 compares if the memory address for the result/return of the method. With primitives, they are the same so it "works"
I did
 
10:46 PM
Really, if you can't tell that the only thing I was apparently wrong about in that is memory address in exchange for object reference I dunno what to do with you
 
fge
There were many other things wrong, of course (liquor stupor, maybe?) but I don't care either way
 
11:27 PM
== is essentially pointer equality, no?
Hey @Kylar!
 
fge
@Michael no, it's reference equality
But again, nothing in the literature of Java says that for two references r1 and r2, r1 == r2 means that they are exactly the same "memory piece" (and, again, of course, in practice, this happens to be the case in all implementations since that just makes sense)
 
So...what does it say, then?
 
fge
Note how the spec only says "the same object or array"
Nothing is said about memory location
 
11:43 PM
You're expecting me to read. On a Friday. xD
Mmm. So "same object" does not necessarily equate to "same memory location". But it is implied.
 
fge
I'd rather say, it is a logical deduction
 
Mmm.
 
fge
Yet the spec says nothing about that
I reason too much like a physician, I guess :p But had we stuck to "logical deductions", we would still believe that heavy bodies fell faster than lighter bodies, right?
 
True dat. Dog.
Sorry. "dawg"
I spelled it wrong.
 
00:00 - 21:0021:00 - 00:00

« first day (1945 days earlier)      last day (3010 days later) »