Function Overload and Named Arguments¶
- Function overload might cause tricky invoking bugs if you change the signature of an overloaded function. You should always be careful when you change the signature of an overloaded function. There is a graceful way of resolving this kind of issues in Kotlin (and similarly in Scala and Python), which is to use named arguments. If you invoke an function with named arguments, it is relatively robust to change of order of arguments and it fails fast if you change the names of arguments.
Bitwise Operators in Java
The Bitwise operators has relative low precedence. They have lower precedence than arithmatical operators. It is suggested that you use parentheses when you mix lower precendenc (bitwise opertors, ternary opertor, etc.) and high precendenc operators together.
There is no unsigned left shift operator in Java. https://www.quora.com/Why-is-there-no-unsigned-left-shift-operator-in-Java
Hashmap in Kotlin
References¶
- LinkedHashMap preserves the insertion order (which is similar to dict in Python 3.7+).
Set in Java
Reference¶
Rounding Numbers in Kotlin
System.out.printf¶
Ways to To Run a Kotlin JAR
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
If you generate a uber JAR,
then you can directly using the java command to run the JAR file
without specifying additional Kotlin runtime/stdlib JAR.
https://stackoverflow.com/questions/9355690 …