r/programming • • Feb 22 '15

Java Makes Programmers Want To Do Absolutely Anything Else With Their Time

http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/
35 Upvotes

636 comments sorted by

View all comments

Show parent comments

1

u/nqd26 Feb 22 '15

Everything being a heap-allocated object in Java

But this is not really true anymore. Java does escape analysis (IIRC from Java 6 with some option, from Java 7 by default) and puts short-lived (i.e. those which don't escape method scope) objects on stack.

2

u/[deleted] Feb 22 '15

[removed] — view removed comment

1

u/nqd26 Feb 22 '15

Are you talking about "growability" of collections? If so, it can be solved by preallocating the necessary number of elements (if known), e.g. new ArrayList(1000) or even new ArrayList(otherColl.size())