Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit 1612cf2

Browse files
committed
デモコードまで追記
1 parent 98f30d2 commit 1612cf2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,36 @@
22
![Lint, Test, and upload Coveradge with Gradle.](https://github.com/ProjectMapK/FastKFunction/workflows/Lint,%20Test,%20and%20upload%20Coveradge%20with%20Gradle./badge.svg)
33
[![codecov](https://codecov.io/gh/ProjectMapK/FastKFunction/branch/master/graph/badge.svg?token=LcZTfSL7c8)](https://codecov.io/gh/ProjectMapK/FastKFunction)
44

5+
---
6+
57
FastKFunction
8+
===
9+
`FastKFunction` is a wrapper library for fast calls to `KFunction`.
10+
11+
## Demo code
12+
With just this description, you can call the `KFunction` faster.
13+
14+
```kotlin
15+
data class Sample(
16+
val arg1: Int,
17+
val arg2: Int,
18+
val arg3: Int,
19+
val arg4: Int,
20+
val arg5: Int
21+
)
22+
23+
val function: KFunction<Sample> = ::Sample
24+
25+
val fastKFunction: FastKFunction<Sample> = FastKFunction(function)
26+
27+
// call by vararg
28+
val result: Sample = fastKFunction.call(1, 2, 3, 4, 5)
29+
30+
// call by Collection
31+
val result: Sample = fastKFunction.callByCollection(listOf(1, 2, 3, 4, 5))
32+
33+
// call by ArgumentBucket
34+
val result: Sample = fastKFunction.generateBucket()
35+
.apply { (0 until 5).forEach { this[it] = it + 1 }}
36+
.let { fastKFunction.callBy(it) }
37+
```

0 commit comments

Comments
 (0)