fellshard
03/18/2016, 5:25 AMforEach
, you can derive a set of other common operations: Append (++
), map
, copy
, isEmpty
, etc.fellshard
03/18/2016, 5:28 AMcedric
03/18/2016, 6:04 AMcedric
03/18/2016, 6:04 AMcedric
03/18/2016, 6:05 AMcedric
03/18/2016, 6:06 AMfellshard
03/18/2016, 6:17 AMhints on the concrete instanceThat seems like a case where you need more specific interfaces. Even if they appear to have similar methods, you may be able to set different expectations between them, with implementations choosing the interfaces that they best fit. Though then you run into the issue with namespace collisions, etc. So it's not a perfect solution, either.
cedric
03/18/2016, 6:22 AMLinkedList
is random access but practically, it's probably never the right thing to do.fellshard
03/18/2016, 6:31 AMvoddan
03/31/2016, 6:56 AMsmthOrNull
throw IllegalArgumentException
if its usage is incorrect?
Or is it too confusing? What's the convention?kirillrakhman
03/31/2016, 7:16 AMvoddan
03/31/2016, 7:32 AMkirillrakhman
03/31/2016, 7:33 AMvoddan
04/02/2016, 6:18 PMpublic fun CharSequence.removeRange(range: IntRange): CharSequence = removeRange(range.start, range.endInclusive + 1)
is it not inlined intentionally?orangy
voddan
04/02/2016, 11:16 PMvoddan
04/02/2016, 11:16 PMeddie
04/02/2016, 11:18 PMorangy
eddie
04/02/2016, 11:19 PMeddie
04/02/2016, 11:20 PMorangy
eddie
04/02/2016, 11:23 PMvoddan
04/05/2016, 2:54 PMA::class extends B::class
https://youtrack.jetbrains.com/issue/KT-11783
https://kotlinlang.slack.com/archives/stdlib/p1457533017000408kirillrakhman
04/05/2016, 2:56 PMorangy
voddan
04/05/2016, 2:58 PMkirillrakhman
04/05/2016, 2:58 PMkirillrakhman
04/08/2016, 1:31 PMinline fun <T> T.assuming(condition: (T) -> Boolean) = if (condition()) this else null
Example usage:
val lines : String? = file.assuming { it.exists() }?.readText()
michaelrocks
04/08/2016, 1:32 PMgiven