https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
stdlib
  • b

    bissell

    06/16/2018, 11:50 PM
    I remember Josh Bloch telling a story in some interview about how he left this out of the Java APIs and had some co-worker grumble about the "axiom of choice". He later regretted the decision and thought it would often be a useful method, but I don't know what his reasons were.
    👍 1
    o
    k
    • 3
    • 5
  • a

    Aregev2

    06/19/2018, 5:41 AM
    Are there plans to optimize kotlin reflection, since its slower than java reflection.
    i
    • 2
    • 2
  • a

    Aregev2

    06/19/2018, 5:43 AM
    And also maybe add a function that takes a class's superclass as a KClass and all implemented interfaces as a List<KClass> I already got an easy algorithm for both based on the class.superclasses and it might be easier just implementing it to kotlin-reflect
  • l

    LeoColman

    06/19/2018, 7:14 PM
    Hey guys! Can we get some attention at this issue? https://youtrack.jetbrains.com/issue/KT-24995
    a
    • 2
    • 8
  • a

    Aregev2

    06/20/2018, 9:35 AM
    Maybe addElements is more suitable insted of addAll
    l
    • 2
    • 1
  • e

    enleur

    07/01/2018, 10:20 AM
    oh god.. please no
    ➕ 11
    a
    g
    • 3
    • 8
  • l

    littlelightcz

    07/06/2018, 9:38 AM
    (moved from #language-proposals)
    s
    a
    +5
    • 8
    • 40
  • r

    rrva

    07/08/2018, 8:02 AM
    If I have a stream of
    [a, b, c, d]
    what’s a simple and idiomatic way to transform this into a stream of pairs
    [[a, b], [c, d]]
    a
    • 2
    • 6
  • p

    pniederw

    07/08/2018, 8:43 PM
    what’s the difference between
    kotlin-stdlib
    and
    kotlin-stdlib-common
    ? both are on my class path, which results in duplicate hits in searches.
    k
    o
    • 3
    • 26
  • e

    elect

    07/10/2018, 9:49 AM
    it'd would be nice if I can set the value by simply calling
    ref(value)
    instead
    ref.set(value)
    g
    l
    • 3
    • 43
  • l

    LeoColman

    07/12/2018, 1:33 AM
    Hey @thomasnield! Do you have a youtrack issue for that?
    t
    • 2
    • 2
  • i

    ilya.gorbunov

    07/12/2018, 3:15 AM
    @thomasnield We had such ranges in mind: so before 1.0 we had renamed
    Range
    to
    ClosedRange
    and its
    end
    property to
    endInclusive
    and dropped
    FloatRange
    and
    DoubleRange
    to make it possible to introduce open-ended ranges without breaking changes later.
    t
    • 2
    • 2
  • t

    thomasnield

    07/13/2018, 12:39 AM
    For cases like using histograms, I imagine we would want the last range to be inclusive. But doing so right now results in an
    List<Any>
    due to lack of common
    Range
    interface.
    k
    i
    • 3
    • 19
  • t

    thomasnield

    07/14/2018, 12:48 AM
    https://github.com/Kotlin/KEEP/pull/137
    k
    • 2
    • 3
  • k

    karelpeeters

    07/28/2018, 2:37 PM
    Is that information even present runtime?
    a
    • 2
    • 3
  • a

    Aregev2

    07/29/2018, 9:03 AM
    Time to open YouTrack
    k
    • 2
    • 11
  • a

    Aregev2

    07/29/2018, 11:21 AM
    https://youtrack.jetbrains.com/issue/KT-25794 Found another one
    • 1
    • 1
  • k

    karelpeeters

    07/30/2018, 9:41 AM
    And the extra allocation shouldn't be much,
    asList
    returns an
    ArrayList
    backed by the given array.
    m
    • 2
    • 1
  • v

    vmichalak

    08/07/2018, 1:04 PM
    Just a question: Anyone know why DoubleRange does not exists in the StdLib ?
    c
    k
    s
    • 4
    • 13
  • d

    Daniel Cordell

    08/08/2018, 11:26 AM
    Hey everyone, hope I'm asking in the right channel. Does there exist a standard multiplatform way to get the 'null' file i.e.
    /dev/null
    or
    NUL
    ? Something like python's os.devnull.
    h
    • 2
    • 4
  • s

    shusek

    08/08/2018, 12:10 PM
    For curiosity, why extension of array return list? It does not make sense to me. intArrayOf(1,2,3).filter { it > 1} = List<Int>
    d
    h
    • 3
    • 4
  • m

    miha-x64

    08/10/2018, 1:07 PM
    LinkedList
    can't be more efficient under any circumstances
    ➕ 3
    ➖ 1
    k
    a
    g
    • 4
    • 9
  • a

    Aregev2

    08/10/2018, 1:31 PM
    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...
    k
    • 2
    • 6
  • j

    jw

    08/17/2018, 3:32 PM
    it's the pairwise inverse of
    intersect
    . i think it might be too specialized to warrant stdlib inclusion though.
    :yes: 1
    e
    k
    • 3
    • 4
  • m

    marcinmoskala

    08/19/2018, 9:49 AM
    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?
    s
    • 2
    • 4
  • i

    ilya.gorbunov

    09/05/2018, 11:41 AM
    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.
    Renaming_buildSequence
    r
    g
    +4
    • 7
    • 13
  • m

    maxmello

    09/11/2018, 3:31 PM
    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 🙈
    i
    • 2
    • 3
  • j

    jw

    09/12/2018, 6:05 PM
    is there a way to offset an IntRange?
    i
    • 2
    • 1
  • d

    Dominaezzz

    09/12/2018, 7:40 PM
    Can a
    Closeable
    and/or
    AutoCloseable
    interface be added to the standard library?
    s
    e
    u
    • 4
    • 15
  • a

    anidotnet

    09/18/2018, 9:20 AM
    Is there any plan to include file api and network api in standard library?
    d
    v
    l
    • 4
    • 6
Powered by Linen
Title
a

anidotnet

09/18/2018, 9:20 AM
Is there any plan to include file api and network api in standard library?
d

Dominaezzz

09/18/2018, 9:29 AM
For network api, there's ktor.
Standard file api will come eventually.
v

voddan

09/18/2018, 1:07 PM
Standard file api will come eventually
I would not be so sure. Different platforms handle files very differently
d

Dominaezzz

09/18/2018, 1:27 PM
But basic stuff like read/write of bytes/text to files should be available.
Although I doubt it'll be in stdlib. It'll be it's own library.
l

louiscad

09/18/2018, 4:46 PM
There are already a few files related extension in the
<http://kotlin.io|kotlin.io>
package as of Kotlin stdlib 1.2 for JDK
View count: 1