As everyone who is working with Kotlin. They start loving kotlin as I worked in a team with Kotlin Language. I find out more difficulties then easiness and I find out one quote I think from Spider-Man movie. “With great power comes great responsibility.” To me, that is a real use case of this quote.
Expectations from my Kotlin Posts:
Our posts will not be on Kotlin syntax and concepts. Instead, our main focus will be how and where we should use what from Kotlin. Like what is a good use case of let operator.
Java vs Kotlin :
I love both languages. Mostly our argument against Java is, Java is verbose, need to write a lot of code, not idiomatic, etc. But when we started Kotlin reading and writing, we find out we are writing a lot of code in kotlin too. Code is not readable, etc. So all the arguments which we have against Java become useless :(.
Our Mantra “Write less code”:
Write less code. That will be motivation for our Kotlin posts. How we can make that, only we can produce by knowing Kotlin API’s.
All our posts will contain my personal opinion. I learn from different sources or experiences. Maybe I will be wrong in some places. So, anyone who feels we can achieve something a better way, please share I am always open to improving myself.
The easiest way to learn Kotlin Collection made your collection. In this series, we will create a class with the name “OurCollection.” That will contain all the methods which are given by Kotlin, but we will implement on our own. So once we will do practice, we will be more comfortable to use these powerful functions. Publish plan of this series as given below:
- Our Collections methods:
- ourAll, ourAny ( Our Collection API like Kotlin Collection API )
- asIterable, asSequence
- associate, associateBy, associateByTo, associateTo, associateWith, associateWithTo
- component1, component2, component3, component4, component5
- distinct, distinctBy
- drop, dropLast, dropLastWhile, dropWhile
- elementAt, elementAtOrElse, elementAtOrNull
- filter, filterIndexed, filterIndexedTo, filterIsInstance, filterIsInstanceTo, filterNot, filterNotNull, filterNotNullTo, filterNotTo, filterTo
- find, findLast, first, firstOrNull
- flatMap, flatMapTo
- fold, foldIndexed, foldRight, foldRightIndexed
- forEach, forEachIndexed
- getOrElse, getOrNull
- groupBy, groupByTo, groupingBy
- indexOf, indexOfFirst, indexOfLast
- joinTo, joinToString
- last, lastIndexOf, lastOrNull
- map, mapIndexed, mapIndexedNotNull, mapIndexedNotNullTo, mapIndexedTo, mapNotNull, mapNotNullTo, mapTo
- max, maxBy, maxWith
- min, minBy
- minus, minusElement, minWith
- partition, plus, plusElement
- reduce, reduceIndexed, reduceRight, reduceRightIndexed
- reverse, reversed
- single, singleOrNull
- sortBy, sortByDescending, sortDescending, sorted, sortedBy, sortedByDescending, sortedDescending, sortedWith
- subtract, sum, sumBy, sumByDouble
- take, takeLast, takeLastWhile, takeWhile
- toBooleanArray, toByteArray, toCharArray, toCollection, toDoubleArray, toFloatArray, toHashSet, toIntArray, toList, toLongArray, toMutableList, toMutableSet, toSet, toShortArray
- zip, zipWithNext