Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/linktosriram/kext4j

Kotlin Extension Functions for Java
https://github.com/linktosriram/kext4j

java java-library kotlin kotlin-extensions

Last synced: 5 days ago
JSON representation

Kotlin Extension Functions for Java

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.com/linktosriram/kext4j.svg?branch=master)](https://travis-ci.com/linktosriram/kext4j)

# kext4j

Kotlin Extension Functions for Java.

Implementation of kotlin extension methods for Java.

Currently in-progress:
* https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html

## Provided functions

### StringUtils

* [indices](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/indices.html)
* [lastIndex](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/last-index.html)
* [all](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/all.html)
* [any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/any.html)
* [asIterable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/as-iterable.html)
* [asSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/as-sequence.html)
* [byteInputStream](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/byte-input-stream.html)
* [capitalize](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/capitalize.html)
* [chunked](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/chunked.html)
* [commonPrefixWith](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/common-prefix-with.html)
* [commonSuffixWith](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/common-suffix-with.html)
* [contains](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/contains.html)
* [count](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/count.html)
* [decapitalize](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/decapitalize.html)
* [drop](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/drop.html)
* [dropLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/drop-last.html)
* [dropLastWhile](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/drop-last-while.html)
* [dropWhile](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/drop-while.html)
* [elementAtOrElse](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/element-at-or-else.html)
* [elementAtOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/element-at-or-null.html)
* [endsWith](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/ends-with.html)
* [filter](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/filter.html)
* [filterIndexed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/filter-indexed.html)
* [filterIndexedTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/filter-indexed-to.html)
* [filterNot](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/filter-not.html)
* [filterNotTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/filter-not-to.html)
* [filterTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/filter-to.html)
* [find](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/find.html)
* [findAnyOf](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/find-any-of.html)
* [findLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/find-last.html)
* [findLastAnyOf](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/find-last-any-of.html)
* [first](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/first.html)
* [firstOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/first-or-null.html)
* [flatMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/flat-map.html)
* [flatMapTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/flat-map-to.html)
* [fold](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/fold.html)
* [foldIndexed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/fold-indexed.html)
* [foldRight](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/fold-right.html)
* [foldRightIndexed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/fold-right-indexed.html)
* [forEach](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/for-each.html)
* [forEachIndexed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/for-each-indexed.html)
* [getOrElse](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/get-or-else.html)
* [getOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/get-or-null.html)
* [groupBy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/group-by.html)
* [groupByTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/group-by-to.html)
* [hasSurrogatePairAt](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/has-surrogate-pair-at.html)
* [ifBlank](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/if-blank.html)
* [ifEmpty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/if-empty.html)
* [indexOf](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/index-of.html)
* [indexOfAny](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/index-of-any.html)
* [indexOfFirst](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/index-of-first.html)
* [indexOfLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/index-of-last.html)
* [isBlank](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-blank.html)
* [isEmpty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-empty.html)
* [isNotBlank](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-not-blank.html)
* [isNotEmpty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-not-empty.html)
* [isNullOrBlank](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-null-or-blank.html)
* [isNullOrEmpty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-null-or-empty.html)
* [iterator](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/iterator.html)
* [last](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/last.html)
* [lastIndexOf](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/last-index-of.html)
* [lastIndexOfAny](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/last-index-of-any.html)
* [lastOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/last-or-null.html)
* [lines](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/lines.html)
* [lineSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/line-sequence.html)
* [map](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map.html)
* [mapIndexed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map-indexed.html)
* [mapIndexedNotNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map-indexed-not-null.html)
* [mapIndexedNotNullTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map-indexed-not-null-to.html)
* [mapIndexedTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map-indexed-to.html)
* [mapNotNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map-not-null.html)
* [mapNotNullTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map-not-null-to.html)
* [mapTo](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/map-to.html)
* [max](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/max.html)
* [maxBy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/max-by.html)
* [maxWith](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/max-with.html)
* [min](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/min.html)
* [minBy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/min-by.html)
* [minWith](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/min-with.html)
* [none](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/none.html)
* [onEach](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/on-each.html)
* [orEmpty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/or-empty.html)
* [padEnd](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/pad-end.html)
* [padStart](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/pad-start.html)
* [partition](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/partition.html)
* [prependIndent](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/prepend-indent.html)
* [random](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/random.html)
* [reader](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/reader.html)
* [reduce](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/reduce.html)
* [reduceIndexed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/reduce-indexed.html)
* [reduceRight](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/reduce-right.html)
* [reduceRightIndexed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/reduce-right-indexed.html)
* [regionMatches](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/region-matches.html)
* [removePrefix](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/remove-prefix.html)
* [removeRange](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/remove-range.html)
* [removeSuffix](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/remove-suffix.html)
* [removeSurrounding](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/remove-surrounding.html)
* [replace](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace.html)
* [replaceAfter](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-after.html)
* [replaceAfterLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-after-last.html)
* [replaceBefore](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-before.html)
* [replaceBeforeLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-before-last.html)
* [replaceFirst](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-first.html)
* [replaceIndent](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-indent.html)
* [replaceIndentByMargin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-indent-by-margin.html)
* [replaceRange](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-range.html)
* [reversed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/reversed.html)
* [single](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/single.html)
* [singleOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/single-or-null.html)
* [slice](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/slice.html)
* [split](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/split.html)
* [splitToSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/split-to-sequence.html)
* [startsWith](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/starts-with.html)
* [subSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/sub-sequence.html)
* [substring](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/substring.html)
* [substringAfter](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/substring-after.html)
* [substringAfterLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/substring-after-last.html)
* [substringBefore](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/substring-before.html)
* [substringBeforeLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/substring-before-last.html)
* [sumBy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/sum-by.html)
* [sumByDouble](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/sum-by-double.html)
* [take](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/take.html)
* [takeLast](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/take-last.html)
* [takeLastWhile](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/take-last-while.html)
* [takeWhile](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/take-while.html)
* [toBigDecimal](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-big-decimal.html)
* [toBigDecimalOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-big-decimal-or-null.html)
* [toBigInteger](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-big-integer.html)
* [toBigIntegerOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-big-integer-or-null.html)
* [toByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-byte-array.html)
* [toByteOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-byte-or-null.html)
* [toCharArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-char-array.html)
* [toCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-collection.html)
* [toHashSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-hash-set.html)
* [toIntOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-int-or-null.html)
* [toList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-list.html)
* [toLongOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-long-or-null.html)
* [toMutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-mutable-list.html)
* [toPattern](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-pattern.html)
* [toRegex](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-regex.html)
* [toSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-set.html)
* [toShortOrNull](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-short-or-null.html)
* [toSortedSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-sorted-set.html)
* [trim](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim.html)
* [trimEnd](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-end.html)
* [trimIndent](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-indent.html)
* [trimMargin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-margin.html)
* [trimStart](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-start.html)
* [windowed](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/windowed.html)
* [zip](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/zip.html)
* [zipWithIndex](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/zip-with-next.html)

## Example

```java
import static io.github.linktosriram.kext4j.text.StringUtils.*;

map("hello world", Character::toUpperCase); // [H, E, L, L, O, , W, O, R, L, D]
filter("Hello World", Character::isUpperCase); // "HW"
groupBy("Hello World", Character::isUpperCase); // {true=[H, W], false=[e, l, l, o, , o, r, l, d]}
```

## License

This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.