My Realm

Xtended Android

Xtend has become my favorite thing now. With type inference, lambdas and extension methods, this has just won my heart. Now, if you look at the picture, you can clearly see how much it matches with java(the Xtend file gets translated to java rather than bytecode) and how much it differs at the same time.(deep, huh?) Allow me to explain the beauty of it, the keyword "def" is for declaring a function, as you can see that I have not specified any return type, because type inference bruh. Xtend can judge the return type from the body of the function, and same goes for variables. For example this line
"val wmMethods = wifiManager.class.methods",this is exactly where I fall in love with Xtend. 

.forEach[ ] is a function that actually is quite interesting and important. Just like,

forEach also iterates over the calling field/variable. This lambda function comes extremely handy when working with collections.
And finally in the end is the "AccessPointStatus" which is responsible for telling the return type of the function.

This post wasn't supposed to be like a tutorial, actually I just wanted to generate interest in you, so please don't feel betrayed if I just scratched the surface and nothing more. The internet is full with informative articles and lessons for Xtend. Trust me, you need to check them out.

No comments:

Post a Comment

I am on Wordpress too.|No Copyright © 2014

Powered by Blogger.