driver733 / kotlin-vs-java Goto Github PK
View Code? Open in Web Editor NEWKotlin vs Java comparison with side-by-side code snippets
Home Page: https://www.kotlinvsjava.com
License: MIT License
Kotlin vs Java comparison with side-by-side code snippets
Home Page: https://www.kotlinvsjava.com
License: MIT License
Hi,
You've done a cool project!
Could you specify the version of two language. Maybe the codes should be re-organized by version in the future in order to avoid becoming obsolete.
For example, le chapter : Strings II
is true for java version < 13 but this feature (""" {formed String}""") is added in JAVA 13.
Regards
How about some coroutines? I don't think there's any other feature that makes Kotlin win by such a large margin as replacing a bunch of unwieldy, nested callbacks with clean sequential code.
Granted, it's not a one-liner example, but that is the problem with this kind of comparisons, the micro-scale differences in single-expression syntax aren't the things that make or break a language.
The generics in the concurrency examples are interpreted as html tags and therefore don't show up.
java's list.sort()
sorts this
list, mutating it. kotlin's list.sortedBy()
returns new list without mutating this
I don't think val x: Int
would ever compile, to take an example from Variables I. It would have to be either lateinit or nullable.
It seems like the titles for the "Functions" tab do not really correspond to their code examples. For example:
fun hasItems() : Boolean {
return true
}
has nothing to do with its title "Null I"
The Kotlin "Hello world" makes it kind of unclear how one can get command line arguments. Maybe have another "Hello, name" example that shows this?
At least to me, this site seems to be playing favorites to Kotlin over Java without declaring that anywhere (that I've found).
What I find off about this:
On the counterside, some examples do show Java in a better light, like Kotlin's removal of the tenary operator in favor of writing a full if else statement in one line.
I'm I wrong in thinking that this does not work in Java?
add ci
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.