Is Kotlin better than Java 8? [ & Kotlin Java Scala 文章集锦]-阿里云开发者社区

开发者社区> 开发与运维> 正文
登录阅读全文

Is Kotlin better than Java 8? [ & Kotlin Java Scala 文章集锦]

简介: Java 8 is a mature language and with more developers and a community to support its use in android development with great resu...

Java 8 is a mature language and with more developers and a community to support its use in android development with great results and productivity and more developers are used to Java 8.
Kotlin is safe, concise, interoperable, tool friendly and comes with data classes and other useful features below which java 8 does not offer.

“Kotlin has way, way more to offer than Java 8. Here is just a sampling (in no particular order)

Null-safety
Type inference
String interpolation
Data classes
Delegation
Smart casts
Conditionals as expressions
Sealed classes
The when expression
Extension functions
Co-routines in 1.1

... and I'm sure I've just scratched the surface”-What if the future of Kotlin when/if Java 8 becomes available on Android? • r/Kotlin

How will Java 8 impact Kotlin?
“Comparison to Java Programming Language
Some Java issues addressed in Kotlin
Kotlin fixes a series of issues that Java suffers from
Null references are controlled by the type system.
No raw types
Arrays in Kotlin are invariant
Kotlin has proper function types, as opposed to Java's SAM-conversions
Use-site variance
without wildcards

Kotlin does not have checked exceptions

What Java has that Kotlin does not
Checked exceptions
Primitive types that are not classes
Static members
Non-private fields
Wildcard-types

What Kotlin has that Java does not
Lambda expressions+Inline functions = performant custom control structures
Extension functions
Null-safety
Smart casts
String templates
Properties
Primary constructors
First-class delegation
Type inference for variable and property types
Singletons
Declaration-site variance & Type projections
Range expressions
Operator overloading
Companion objects
Data classes
Separate interfaces for read-only and mutable collections
Coroutines

Comparison to Java - Kotlin Programming Language

footnotes:
Kotlin vs. Java: First Impressions Using Kotlin | ArcTouch
Java vs. Kotlin: Should You Be Using Kotlin for Android Development?
10 Features I Wish Java Would Steal From the Kotlin Language
Java vs. Kotlin: First Impressions Using Kotlin for a Commercial Android Project - DZone Mobile
Java 8 vs Kotlin
Does Kotlin have better functional programming support than Java 8 streams and lambdas?
Functional programming in Java 8, Kotlin and Scala
Java vs. Kotlin: Android Programming Languages
What are the advantages of Kotlin over Java?
Kotlin vs Java: key differences between Android's officially-supported languages
Kotlin Programming Language

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章