• gregorbg

    gregorbg

    3 years ago
    Map<K, Set<T>>
    or
    Map<K, Iterable<T>>
    will also be perfectly fine, I'm mainly concerned about the grouping aspect and not the explicit return type
    gregorbg
    Pavlo Liapota
    2 replies
    Copy to Clipboard
  • r

    rrader

    3 years ago
    What do you think about adding
    Option
    class? The use case https://youtrack.jetbrains.com/issue/KT-29026
    r
    karelpeeters
    +3
    6 replies
    Copy to Clipboard
  • asad.awadia

    asad.awadia

    3 years ago
    If i have a list of pairs (to and from) and want to get the distinct sorted pairs that occur the most what would be the most functional way of doing it? So
    [(1,2) , (3,4), (1,2)]
    should return
    [(1,2),(3,4)]
    asad.awadia
    ilya.gorbunov
    +2
    18 replies
    Copy to Clipboard
  • p

    PHondogo

    3 years ago
    Hello, were can i see changes to stdlib from version to version? I mean like in kotlin release notes. What was added or improved in stdlib...
    p
    ilya.gorbunov
    2 replies
    Copy to Clipboard
  • t

    Timmy

    3 years ago
    In the kotlin stdlib the
    LinkedHashMap
    does not have the
    accessOrder
    property that the
    java.util.LinkedHashMap
    has. Is there a replacement if I want to use such a functionality, for example for as a LRU cache? Or should I look for a third party library for simple LRU caching (with kotlin multiplatform support)?
    t
    josephivie
    2 replies
    Copy to Clipboard
  • josephivie

    josephivie

    3 years ago
    Why is it
    interface Comparator<T>
    instead of
    interface Comparator<in T>
    ? Like, I know theoretically you shouldn't have to specify that the
    T
    has
    in
    variance, but in common code errors will be shown if you do something like
    interface Sort<in T>: Comparator<T>
    , saying the
    T
    in
    Comparator
    is
    invariant
    .
    josephivie
    1 replies
    Copy to Clipboard
  • r

    rrader

    3 years ago
    is there a function analogical to
    let
    but for empty strings
    someString?.let { calculate(it) }
    I need
    someString.doIfNotEmpty { calculate(it) }
    ?
    r
    Czar
    2 replies
    Copy to Clipboard
  • asad.awadia

    asad.awadia

    3 years ago
    Can it be implemented as a dsl tho?
    asad.awadia
    gildor
    +2
    15 replies
    Copy to Clipboard
  • gregorbg

    gregorbg

    3 years ago
    Just wondering, what is the rationale for the
    get
    operator returning
    Nullable?
    types for Maps but not for Lists? I understand that in a map, you may not know whether the key is set. But in a List, you may not know whether the index exists (i.e. the list is long enough) either??!
    gregorbg
    Shawn
    +1
    13 replies
    Copy to Clipboard
  • asad.awadia

    asad.awadia

    3 years ago
    How can I write a lambda with a receiver such that I can write the following style DSL
    createHttpServer {
                options = myServerOptionsObjectVariableFromAboveSomewhere
                port = 8080
            }
    which should run effectively
    vertx().createHttpServer(options).listen(port)
    ?
    asad.awadia
    Shawn
    13 replies
    Copy to Clipboard