Releases: skydoves/WhatIf
Releases · skydoves/WhatIf
1.2.2
1.2.1
Full Changelog: 1.2.0...1.2.1
1.2.0
1.1.4
1.1.3
1.1.2
1.1.1
What's Changed
- Feature: Every
whatifrelevant functions use Contracts internally by @skydoves in #11 - API explicit mode by @skydoves in #9
- Integrate: Binary Validator by @skydoves in #10
Introduce
Since 1.1.1, every whatIf relevant functions use the Contracts as AT_MOST_ONCE internally.
It improving the variable initialization analysis in the presence of high-order functions:
val string: String
nullableString.whatIfNotNull {
string = it
// do something //
}Full Changelog: 1.1.0...1.1.1
1.1.0
🎉 Released a new version 1.1.0! 🎉
What's New?
- Added new function
whatIfFindFragmentforFragmentActivity.
An expression for invoking [whatIf] when the [FragmentActivity] has an attached fragment [T].
.whatIfFindFragment<MainTestFragment>(fragment_id) {
// do something
}
whatIfFindFragment<MainTestFragment>(MainTestFragment.TAG) {
// do something
}- Added new function
whatIfFindParentInterfacefor finding a parent interface forFragment. - Added new function
whatIfHasDeepLinkUrifor invokingwhatIfwhen theActivity's intent deep link URI is not null and not empty. - Changed
WhatIfInlineOnlyto internal.
1.0.9
🎉 Released a new version 1.0.9! 🎉
What's New?
- Added
WhatIfMapand deprecatedwhatIfLet.
The basic concept is the same aswhatIf. An expression for invokingwhatIfwhen the target object is not null.
It is useful when the receiver and the result should be different.
val length = nullableString.whatIfMap(
whatIf = { it.length },
whatIfNot = {
log("$it, nullableString is null.")
-1
}
)- Added
WhatIfAndandWhatIfOrexpressions for the nullable-Boolean iterables. - Added some expressions for collections.
We can use default value instead of thewhatIfNotand can be omitted thewhatIfNot.
val length = nullableString.whatIfMap(
default = -1
) {
log("$it, length can not over than 5.")
5
}We can use some expressions for List, Map, and Set.
- whatIfNotNullOrEmpty: An expression for invoking
whatIfwhen theListis not null and not empty. - addWhatIfNotNull: An expression for adding an element and invoking
whatIfwhen the element is not null. - addAllWhatIfNotNull: An expression for adding an element and invoking
whatIfwhen the element is not null. - removeWhatIfNotNull: An expression for removing an element and invoking
whatIfwhen the element is not null. - removeAllWhatIfNotNull: An expression for removing a collection of element and invoking
whatIfwhen the element is not null.
1.0.8
🎉 Released a new version 1.0.8! 🎉