peter-tackage / kotlin-options Goto Github PK
View Code? Open in Web Editor NEWKotlin Options with functional operators
License: Apache License 2.0
Kotlin Options with functional operators
License: Apache License 2.0
How about showing in README first how kotlin would do it's null mapping, something like this:
getCurrentUserId()
?.takeIf { it.isNotEmpty() && it != "Invalid Id" }
?.let { getCurrentUserFromDatabase(it) }
?.username
?.let { "Logged in user: $it" }
.apply {
if (this != null) {
log(this)
} else {
log("No user to login!")
}
}
Of course we would need to mentione that those versions of getCurrentUserId
and getCurrentUserFromDatabase
return kotlin's nullable
Currently the constructor for Some
is marked internal
. I am now thinking that there's no benefit to not exposing it and preventing direct instantiation as:
Some
and None
classes, so these types are known by library clients.Some
constructor only takes <T : Any>
we prevent incorrect creation or require checkNotNull
like in Java - there's no run time risk.Option
value clearer when using non-nulls than requiring use of optionOf
. It could just be Some("abc")
.Thoughts? @tomaszpolanski
Write a README for each module with a description and usage
Write API docs
The distribution of the artifacts generated from the modules needs to be modified so that each module can be independent included by using a separate artifactId. After this Investigation should include how to upload bintray rather than jitpack.
In kotlin method for filtering out nulls from a list is called filterNotNull
.
Would it make sense to add filterNotNone
and deprecate the filterIfSome?
Hi,
hope find you well with this cold call.
I am an author of mocking framework for Kotlin
I see you are using mockito-kotlin.
I just want you to be aware that there is solution that fully supports Kotlin and ask to try it in your new/current projects.
I can help you if you answer to this issue.
Thanks and please star it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.