Skip to content

[ACTIVE] Helper functions to zip Flows into 3 to 11 arity tuples, and to array.

License

Notifications You must be signed in to change notification settings

Zhuinden/flow-ziptuple-kt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flow-ZipTuple-KT

Ability to zip flows from 3 to 16 arity tuples.

zipTuple(flow1, flow2, flow3)
    .collectLatest { (a, b, c) ->
        // ...
    }

Also allows zipping an arbitrary number of flows into an array.

zipArray(*flows)
    .collectLatest { array ->
        // ...
    }

Using Flow-ZipTuple-KT

In order to use Flow-ZipTuple-KT, you need to add jitpack to your project root build.gradle.kts (or build.gradle):

// build.gradle.kts
allprojects {
    repositories {
        // ...
        maven { setUrl("https://jitpack.io") }
    }
    // ...
}

or

// build.gradle
allprojects {
    repositories {
        // ...
        maven { url "https://jitpack.io" }
    }
    // ...
}

In newer projects, you need to also update the settings.gradle file's dependencyResolutionManagement block:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }  // <--
        jcenter() // Warning: this repository is going to shut down soon
    }
}

and then, add the dependency to your module's build.gradle.kts (or build.gradle):

// build.gradle.kts
implementation("com.github.Zhuinden:flow-ziptuple-kt:1.2.1")

or

// build.gradle
implementation 'com.github.Zhuinden:flow-ziptuple-kt:1.2.1'

License

Copyright 2020 Gabor Varadi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

[ACTIVE] Helper functions to zip Flows into 3 to 11 arity tuples, and to array.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages