让你的代码量减少3倍!使用kotlin开发Android(二) –秘笈!扩展函数



让你的代码量减少3倍!使用kotlin开发Android(一) 创建Kotlin工程



函数扩展是什么东东捏,一般来说,我们扩展一个类,需要去继承来实现,不过这样又要写N多代码呀~~ 标题说了,kotlin能让你的代码量减少至少3倍!不信?快来跟我看看!









lambda不熟悉的话,快去谷歌一下用法哈~ 接下来呢,如果lambda左值参数没有用到的话,是可以省略的,所以现在写成了





具体的语法是 fun + 类型.函数(参数)


来看一下第二个参数,可以给默认值,如果参数不传,则自动调用默认值,这方便了什么?大家想想,没错!! 就是重载!!! 总之最终简化版点击按钮相应弹toast,代码就是一行!





让你的代码量减少3倍!使用kotlin开发Android(三) 缩短五倍的Java Bean

如果你是Android开发者,那么你还可以来 wing的酒馆:425983695来分享你的开发经验哦

让你的代码量减少3倍!使用kotlin开发Android(二) –秘笈!扩展函数》有80个想法

  1. Thank you for some other informative website. Where else may just I am getting that kind of info written in such an ideal means? I’ve a venture that I am just now working on, and I have been on the glance out for such info. adebdedfbfaa

  2. Hi! Someone in my Myspace group shared this website with us so I came to look it over. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Great blog and terrific design and style.

  3. Thanks for this article. I might also like to say that it can end up being hard if you find yourself in school and merely starting out to create a long credit rating. There are many learners who are only trying to endure and have long or good credit history are often a difficult issue to have.

  4. Hey are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you require any coding knowledge to make your own blog? Any help would be really appreciated!

  5. Heya im for the first time here. I discovered this board and I to uncover It truly helpful &amp it helped me out a whole lot. I hope to supply something back and aid other people such as you helped me.

  6. whoah this blog is fantastic i really like studying your articles. Keep up the good paintings! You understand, many individuals are looking around for this info, you could aid them greatly.

  7. I do not even know how I stopped up here, however I assumed this put up was good. I do not recognise who you are however definitely you’re going to a wellknown blogger for those who are not already

  8. Good blog! I really love how it is easy on my eyes and the data are well written. I am wondering how I could be notified whenever a new post has been made. I have subscribed to your feed which must do the trick! Have a nice day!

  9. Spot lets start off perform on this writeup, I seriously consider this astounding internet site needs much more consideration. Ill apt to become once again to find out to read considerably a lot more, thank you that information.

  10. Nice read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch since I found it for him smile So let me rephrase that Thank you for lunch! Whenever you have an efficient government you have a dictatorship. by Harry S Truman.

  11. Hey very nice site!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds alsoI am happy to find a lot of useful info here in the post, we need work out more techniques in this regard, thanks for sharing. . . . . .

  12. Im genuinely enjoying the style and layout of one’s website. Its a very uncomplicated on the eyes which makes it a great deal much more enjoyable for me to come here and pay a visit to far more typically. Did you hire out a designer to make your theme? Excellent perform!

  13. Thank you for the sensible critique. Me &amp my neighbor were just preparing to do a little research about this. We got a grab a book from our local library but I think I learned more from this post. I am very glad to see such excellent info being shared freely out there.

  14. I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, The web site style is wonderful, the articles is really excellent D. Good job, cheers