BaseFinder

abstract class BaseFinder<T, Self>(sequence: Sequence<T>) : INamed

Inheritors

Constructors

Link copied to clipboard
constructor(sequence: Sequence<T>)

Properties

Link copied to clipboard
abstract val name: String

Functions

Link copied to clipboard
fun contact(other: BaseFinder<T, Self>): Self

Concatenate with another finder.

fun contact(other: Array<T>): Self

Concatenate with another array.

fun contact(other: Iterable<T>): Self

Concatenate with another iterable.

fun contact(other: Sequence<T>): Self

Concatenate with another sequence.

Link copied to clipboard
fun filter(filter: T.() -> Boolean): Self

Filter with a predicate.

Link copied to clipboard
open fun first(): T

Get the first element or throw an exception if there is no such element.

open fun first(condition: T.() -> Boolean): T

Get the first element by condition or throw an exception if there is no such element.

Link copied to clipboard
open fun firstOrNull(): T?

Get the first element or null if not found.

open fun firstOrNull(condition: T.() -> Boolean): T?

Get the first element by condition or null if not found

Link copied to clipboard
fun forEach(action: (T) -> Unit)

For-each loop for.

Link copied to clipboard
fun forEachIndexed(action: (index: Int, T) -> Unit)

For-each loop with index for.

Link copied to clipboard
open fun last(): T

Get the last element or throw an exception if there is no such element.

open fun last(condition: T.() -> Boolean): T

Get the last element by condition or throw an exception if there is no such element.

Link copied to clipboard
open fun lastOrNull(): T?

Get the last element or null if not found.

open fun lastOrNull(condition: T.() -> Boolean): T?

Get the last element by condition or null if not found

Link copied to clipboard
fun <R, C : MutableCollection<in R>> mapToCollection(destination: C, transform: (T) -> R): C

Map to the collection.

Link copied to clipboard
fun <R> mapToHashSet(transform: (T) -> R): HashSet<R>

Map to the hashset.

Link copied to clipboard
fun <R> mapToList(transform: (T) -> R): List<R>

Map to the list.

Link copied to clipboard
fun <R> mapToMutableList(transform: (T) -> R): List<R>

Map to the mutable list.

Link copied to clipboard
fun <R> mapToMutableSet(transform: (T) -> R): MutableSet<R>

Map to the mutable set.

Link copied to clipboard
fun <R> mapToSet(transform: (T) -> R): Set<R>

Map to the set.

Link copied to clipboard
fun onEach(action: (T) -> Unit): Self

On-each loop for.

Link copied to clipboard
fun onEachIndexed(action: (index: Int, T) -> Unit): Self

On-each loop with index for.

Link copied to clipboard
operator fun plus(other: BaseFinder<T, Self>): Self
operator fun plus(other: Array<T>): Self
operator fun plus(other: Iterable<T>): Self
operator fun plus(other: Sequence<T>): Self
Link copied to clipboard
operator fun plusAssign(other: BaseFinder<T, Self>)
operator fun plusAssign(other: Array<T>)
operator fun plusAssign(other: Iterable<T>)
operator fun plusAssign(other: Sequence<T>)
Link copied to clipboard
fun requireCount(count: Int): Self
fun requireCount(condition: T.() -> Boolean, count: Int): Self
fun requireCount(condition: T.() -> Boolean, range: IntRange): Self
Link copied to clipboard
fun requireCountOrNull(condition: T.() -> Boolean, count: Int): Self?
fun requireCountOrNull(condition: T.() -> Boolean, range: IntRange): Self?
Link copied to clipboard

Check sequence only has one element.

fun requireSingle(condition: T.() -> Boolean): Self
Link copied to clipboard

Check sequence only has one element or null if not found.

fun requireSingleOrNull(condition: T.() -> Boolean): Self?
Link copied to clipboard
open fun single(): T

Get the single element or throw an exception if there is no such element or more than one element.

open fun single(condition: T.() -> Boolean): T
Link copied to clipboard
open fun singleOrNull(): T?

Get the single element or null if not found.

open fun singleOrNull(condition: T.() -> Boolean): T?
Link copied to clipboard
fun <C : MutableCollection<T>> toCollection(collection: C): C

Make sequence to the collection.

Link copied to clipboard

Make sequence to the hashset.

Link copied to clipboard
fun toList(): List<T>

Make sequence to the list.

Link copied to clipboard

Make sequence to the mutable list.

Link copied to clipboard

Make sequence to the mutable set.

Link copied to clipboard
fun toSet(): Set<T>

Make sequence to the set.