Package kotools.types

Types

ExplicitInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
interface ExplicitInt

Representation of explicit integers.

NegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
value class NegativeInt : ExplicitInt, Comparable<NegativeInt>

Representation of negative integers, including zero.

NonZeroInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
value class NonZeroInt : ExplicitInt, Comparable<NonZeroInt>

Representation of integers other than zero.

NotBlankString
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
value class NotBlankString : Comparable<NotBlankString>

Representation of strings that have at least one character, excluding whitespaces.

NotEmptyList
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
class NotEmptyList<out E> : List<E>

Representation of lists that contain at least one element.

NotEmptyMap
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
class NotEmptyMap<K, out V> : Map<K, V>

Representation of maps that contain at least one entry.

NotEmptySet
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
class NotEmptySet<out E> : Set<E>

Representation of sets that contain at least one element.

PositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
value class PositiveInt : ExplicitInt, Comparable<PositiveInt>

Representation of positive integers, including zero.

StrictlyNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
value class StrictlyNegativeInt : ExplicitInt, Comparable<StrictlyNegativeInt>

Representation of strictly negative integers, excluding zero.

StrictlyPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
value class StrictlyPositiveInt : ExplicitInt, Comparable<StrictlyPositiveInt>

Representation of strictly positive integers, excluding zero.

Functions

notEmptyListOf
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun <E> notEmptyListOf(head: E, vararg tail: E): NotEmptyList<E>

Creates a NotEmptyList starting with a head and containing all the elements of the optional tail.

notEmptyMapOf
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun <K, V> notEmptyMapOf(head: Pair<K, V>, vararg tail: Pair<K, V>): NotEmptyMap<K, V>

Creates a NotEmptyMap starting with a head and containing all the entries of the optional tail.

notEmptySetOf
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun <E> notEmptySetOf(head: E, vararg tail: E): NotEmptySet<E>

Creates a NotEmptySet starting with a head and containing all the elements of the optional tail.

toNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun Int.toNegativeInt(): Result<NegativeInt>

Returns this integer as a NegativeInt, or IllegalArgumentException if this integer is strictly positive.

toNonZeroInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun Int.toNonZeroInt(): Result<NonZeroInt>

Returns this integer as a NonZeroInt, or IllegalArgumentException if this integer equals zero.

toNotBlankString
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun String.toNotBlankString(): Result<NotBlankString>

Returns this string as a NotBlankString, or IllegalArgumentException if this string is blank.

toNotEmptyList
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun <E> Collection<E>.toNotEmptyList(): Result<NotEmptyList<E>>

Returns a NotEmptyList containing all the elements of this collection, or an IllegalArgumentException if this collection is empty.

toNotEmptyMap
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun <K, V> Map<K, V>.toNotEmptyMap(): Result<NotEmptyMap<K, V>>

Returns a NotEmptyMap containing all the entries of this map, or an IllegalArgumentException if this map is empty.

toNotEmptySet
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun <E> Collection<E>.toNotEmptySet(): Result<NotEmptySet<E>>

Returns a NotEmptySet containing all the elements of this collection, or an IllegalArgumentException if this collection is empty.

toPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun Int.toPositiveInt(): Result<PositiveInt>

Returns this integer as a PositiveInt, or IllegalArgumentException if this integer is strictly negative.

toStrictlyNegativeInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun Int.toStrictlyNegativeInt(): Result<StrictlyNegativeInt>

Returns this integer as a StrictlyNegativeInt, or IllegalArgumentException if this integer is positive.

toStrictlyPositiveInt
Link copied to clipboard
common
@SinceKotools(project = Project.Types, version = "3.2")
fun Int.toStrictlyPositiveInt(): Result<StrictlyPositiveInt>

Returns this integer as a StrictlyPositiveInt, or IllegalArgumentException if this integer is negative.