GithubHelp home page GithubHelp logo

heimashi / kotlin_tips Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 146.0 282 KB

[DEPRECATED] 用Kotlin去提高生产力:汇总Kotlin相对于Java的优势,以及怎么用Kotlin去简洁、务实、高效、安全开发的Tips

Kotlin 79.79% Java 20.21%
kotlin

kotlin_tips's Issues

kotlin 相比 java10

你好,看了您的文章,写的非常好; 想请教下java10已经出来了,在正式项目中使用kotlin的好处还有多大。 以我仅写过helloword的经验看,比较喜欢data model和类似List.of的集合字面量,语法上确实简洁了些,但java中有lombok, java8有lambda, 函数式接口, java10又推出了var, 这些都大大的进了一步,在这种情况下想请教下团队要学习kotlin还有没有很有说服力的理由,尤其是kotlin的get set语法不太简洁

这些tips输出楼主都有测试过吗

在将Android studio升级到3.0后 虽然支持了kotlin 但执行main方法 出现 classnotfound错误,网上的方法是用IDEA!!! 楼主自己有测试吗

about 扩展函数不能被override

這樣算是可以被override嗎

class Inner{
}

open class Parent{
    open fun Inner.extendFunc3():String = ""
}

class Child:Parent(){
    override fun Inner.extendFunc3():String = "override"
}

tip13 input == null的判斷寫反了

  1. input == null的判斷寫反了

  2. 再來這邊判斷的解釋會是一個一個往下串的,第一次看可能會無法馬上了解 ?: 往前對應到的地方是哪邊
    input?.length ?: -1

if(     ( if(input != null){input.length}else{input})  == null    ){
    -1 
} else {
    ( if(input != null){input.length}else{input})
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.