-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Iterable#applyForEach, bump ver 16
- Loading branch information
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ plugins { | |
} | ||
|
||
group = "gg.flyte" | ||
version = "1.0.15" | ||
version = "1.0.16" | ||
|
||
repositories { | ||
mavenCentral() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package gg.flyte.twilight.extension | ||
|
||
/** | ||
* Applies the specified action to each element in the iterable. | ||
* | ||
* This extension function iterates through the elements of the iterable and | ||
* applies the given action to each element, allowing for in-place modification | ||
* or transformation of the elements. | ||
* | ||
* @param action The lambda function to apply to each element. | ||
*/ | ||
inline fun <T> Iterable<T>.applyForEach(action: T.() -> Unit) { | ||
forEach { it.action() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gg.flyte.twilight | ||
|
||
import gg.flyte.twilight.extension.applyForEach | ||
|
||
fun main() { | ||
val list = listOf("test", "asd", "34534534asd", "asdas2sd") | ||
list.applyForEach { | ||
println(this) | ||
} | ||
} |