• Post Reply Bookmark Topic Watch Topic
  • New Topic

Implementing Inline Functions.  RSS feed

 
Sheeba lalith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
How to implement the concept of Inline functions in Java?

Thanks & Regards
Sheeba
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HotSpot engine will use every optimization trick in the book, including inlining functions, when its appropriate. Don't worry so much about low-level optimization; just write clear, idiomatic code, and trust HotSpot to optimize for you.
But to answer your question directly: there's nothing like an "inline" keyword. The Java compiler has explicit permission from the language spec to inline some methods in the bytecode -- in particular, short ones that return void -- but otherwise, Java doesn't really have this concept.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!