SCJP 5.0
http://sites.google.com/site/duddlutechnologies/home
The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
That makes x and y eligible for garbage collection.
So for the above case I would say use Integer instead of int. I that correct to say? Is that correct to say in general?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Experience and talent are independent of age
SCJP 5.0
http://sites.google.com/site/duddlutechnologies/home
NoSandeep Jindal wrote:But I had a different requirement. My recursive stack is huge. It is traversing tree, and also using too much of memory.
Thus, since too many recursive calls... say is at 1000th recursive method.. if JVM needs some memory it would call GC to free memory. If my x and y are Objects it would help GC. But if they are primitives it would not help GC. So think in that case using Integer instead of int would be right choice. Correct?
Campbell Ritchie wrote:No
SCJP 5.0
http://sites.google.com/site/duddlutechnologies/home
Sandeep Jindal wrote:
Campbell Ritchie wrote:No
Thanks for your answer, but can please elaborate on it please?
SCJP 5.0
http://sites.google.com/site/duddlutechnologies/home
No. There are instances, eg in the Collections Framework, where Integers are required.Sandeep Jindal wrote:Thus int is always recommended over Integer. Correct?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
It wasn't my idea to go to some crazy nightclub in the middle of nowhere. I just wanted to stay home and cuddle with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|