• s

    shusek

    4 years ago
    For curiosity, why extension of array return list? It does not make sense to me. intArrayOf(1,2,3).filter { it > 1} = List<Int>
    s
    diego-gomez-olvera
    +1
    4 replies
    Copy to Clipboard
  • miha-x64

    miha-x64

    4 years ago
    LinkedList
    can't be more efficient under any circumstances
    miha-x64
    karelpeeters
    +2
    9 replies
    Copy to Clipboard
  • a

    Aregev2

    4 years ago
    How about a method that converts a
    String
    to its binary form (i.e 0s and 1s)
    fun main(args: Array<String>) {
        println("foo".binaryRepresentation())
    }
    
    fun String.binaryRepresentation(): String {
        val bytes = toByteArray()
        val binary = StringBuilder()
        for (b in bytes) {
            var save = b.toInt()
            for (i in 0 until Byte.SIZE_BITS) {
                binary.append(if (save and 128 == 0) 0 else 1)
                save = save shl 1
            }
            binary.append(' ')
        }
        return binary.toString()
    }
    I do not know if there is something in the stdlib that can do it though...
    a
    karelpeeters
    6 replies
    Copy to Clipboard
  • j

    jw

    4 years ago
    it's the pairwise inverse of
    intersect
    . i think it might be too specialized to warrant stdlib inclusion though.
    j
    elizarov
    +1
    4 replies
    Copy to Clipboard
  • marcinmoskala

    marcinmoskala

    4 years ago
    I see that we are missing
    Map.merge
    function in Kotlin:https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#merge-K-V-java.util.function.BiFunction- I can easily add it using extension function. PR?
    marcinmoskala
    Shawn
    4 replies
    Copy to Clipboard
  • ilya.gorbunov

    ilya.gorbunov

    4 years ago
    Hi everyone, we'd like to know your opinion on renaming the
    buildSequence
    and
    buildIterator
    functions. Please share your thoughts regarding the names proposed in the attached post, especially if you find something confusing about any of them.
    ilya.gorbunov
    robin
    +5
    13 replies
    Copy to Clipboard
  • maxmello

    maxmello

    4 years ago
    Maybe add a check to File.copyTo(target: File, overwrite=true, …) weather or not “this” and “target” are in fact the same file, so the file does not get deleted and is then gone when trying to copy it. We need more stupidity protection, at least I do 🙈
    maxmello
    ilya.gorbunov
    3 replies
    Copy to Clipboard
  • j

    jw

    4 years ago
    is there a way to offset an IntRange?
    j
    1 replies
    Copy to Clipboard
  • Dominaezzz

    Dominaezzz

    4 years ago
    Can a
    Closeable
    and/or
    AutoCloseable
    interface be added to the standard library?
    Dominaezzz
    Shawn
    +2
    15 replies
    Copy to Clipboard
  • a

    anidotnet

    4 years ago
    Is there any plan to include file api and network api in standard library?
    a
    Dominaezzz
    +1
    6 replies
    Copy to Clipboard