collection

io.github.iltotore.iron.constraint.collection
object collection

Collection-related constraints.

Attributes

See also

string which contains String-specific implementations for most of these constraints.

Source
collection.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
collection.type

Members list

Type members

Classlikes

final class Contain[V]

Tests if the given collection contains a specific value.

Tests if the given collection contains a specific value.

Type parameters

V

the value the input must contain.

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object Contain

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Contain.type
final class Exists[C]

Tests if at least one element satisfies the given constraint.

Tests if at least one element satisfies the given constraint.

Type parameters

C

the constraint to test against each element.

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object Exists

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Exists.type
final class ForAll[C]

Tests if each element satisfies the given constraint.

Tests if each element satisfies the given constraint.

Type parameters

C

the constraint to test against each element.

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object ForAll

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
ForAll.type
final class Head[C]

Tests if the head of the passed input satisfies the given constraint.

Tests if the head of the passed input satisfies the given constraint.

Type parameters

C

the constraint to test against the first element (head).

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object Head

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Head.type
final class Init[C]

Tests if each element except the last one satisfies the given constraint.

Tests if each element except the last one satisfies the given constraint.

Type parameters

C

the constraint to test against the init.

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object Init

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Init.type
final class Last[C]

Tests if the last element of the passed input satisfies the given constraint.

Tests if the last element of the passed input satisfies the given constraint.

Type parameters

C

the constraint to test against the last element.

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object Last

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Last.type
final class Length[C]

Tests if the length of the passed input satisfies the given constraint.

Tests if the length of the passed input satisfies the given constraint.

Type parameters

C

the constraint to test on the given input.

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object Length

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Length.type
final class Tail[C]

Tests if each element except the first one satisfies the given constraint.

Tests if each element except the first one satisfies the given constraint.

Type parameters

C

the constraint to test against the tail.

Attributes

Companion
object
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
object Tail

Attributes

Companion
class
Source
collection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Tail.type

Types

type Empty = DescribedAs[FixedLength[0], "Should be empty"]

Tests if the input is empty.

Tests if the input is empty.

Attributes

Source
collection.scala
type FixedLength[V <: Int] = DescribedAs[Length[StrictEqual[V]], "Should have an exact length of " + V]

Tests exact length. Supports Iterable and String by default.

Tests exact length. Supports Iterable and String by default.

Attributes

Source
collection.scala
type MaxLength[V <: Int] = DescribedAs[Length[LessEqual[V]], "Should have a maximum length of " + V]

Tests maximum length. Supports Iterable and String by default.

Tests maximum length. Supports Iterable and String by default.

Type parameters

V

the maximum length of the tested input

Attributes

Source
collection.scala
type MinLength[V <: Int] = DescribedAs[Length[GreaterEqual[V]], "Should have a minimum length of " + V]

Tests minimum length. Supports Iterable and String by default.

Tests minimum length. Supports Iterable and String by default.

Type parameters

V

the minimum length of the tested input

Attributes

Source
collection.scala