Kactoos

kactoos-jvm / nnl.rocks.kactoos.scalar / ItemAt

ItemAt

class ItemAt<T : Any> : Scalar<T>

Element from position in Iterator or fallback value if iterator hasn’t this position.

There is no thread-safety guarantee.

Parameters

T - KScalar type

Since 0.3

Constructors

| Name | Summary | |—|—| | <init> | ItemAt(src: Scalar<Iterator<T>>, pos: Int, fbk: Func<Iterable<T>, T>)ItemAt(fallback: T, source: Iterable<T>)
ItemAt(source: Iterable<T>, fallback: Func<Iterable<T>, T> = FuncOf { throw IOException("The iterable is empty") })
ItemAt(position: Int, source: Iterable<T>)
ItemAt(position: Int, source: Iterator<T>)
ItemAt(source: Iterable<T>, position: Int, fallback: Func<Iterable<T>, T>)
ItemAt(iterator: Iterator<T>, fallback: T)
ItemAt(iterator: Iterator<T>, fallback: Func<Iterable<T>, T> = FuncOf { throw IOException("Iterator is empty") })
ItemAt(iterator: Iterator<T>, position: Int, fallback: Func<Iterable<T>, T> = FuncOf { throw IOException( FormattedText( "Iterator doesn't have an element at #%d position", position ).asString() ) })
Ctor.ItemAt(src: KScalar<Iterator<T>>, pos: Int, fbk: Func<Iterable<T>, T>)
Element from position in Iterator or fallback value if iterator hasn’t this position. |

Functions

Name Summary
invoke fun invoke(): T
Get value of this Scalar