vineethraj49
01/28/2021, 8:08 PMnanodeath
01/28/2021, 8:10 PMMatteo Mirk
01/29/2021, 8:55 AMvineethraj49
01/29/2021, 8:56 AMMatteo Mirk
01/29/2021, 8:58 AMvineethraj49
01/29/2021, 8:59 AMMatteo Mirk
01/29/2021, 9:01 AMvineethraj49
01/29/2021, 9:03 AMval map = collection.associateBy { Triple(it.a, it.b, it.c) }
and then doing map.keys.filter { it.first == x }
instead of `map.keys.filter { it.second == x }`;
simplest way to avoid that seemed to be; in the context of the function;
val map = collection.associateBy { K(it.a, it.b, it.c) }
and then map.keys.filter { it.b == x }
and given K
was only needed in the context of said function, didn't need to be pulled out or exposed (even with internal
)
what I'm not sure of; if this is a "recommended" patternMatteo Mirk
01/29/2021, 11:29 AMprivate
it won’t be exposed anywhere. If I were to read code with local data types it would look less readable to me, but I guess it’a a matter of taste. There are no guidelines on this that I know of.mkrussel
01/29/2021, 1:04 PM