MinimalPartialOrderedSetProxy

cats.collections.laws.MinimalPartialOrderedSetProxy

We test all default methods against this proxy so overrides can never change semantics

Attributes

Source
PartiallyOrderedSetLaws.scala
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def add[A](fa: F[A], a: A)(implicit order: Order[A]): F[A]

Add an item to fa

Add an item to fa

Attributes

Source
PartiallyOrderedSetLaws.scala
def contains[A : Order](fa: F[A], a: A): Boolean

use the heap property to be more efficient than toSortedList to check containment

use the heap property to be more efficient than toSortedList to check containment

Attributes

Source
PartiallyOrderedSetLaws.scala
def empty[A]: F[A]

return an empty F

return an empty F

Attributes

Source
PartiallyOrderedSetLaws.scala
def minimumOption[A](fa: F[A]): Option[A]

Get the minimum value from fa if not empty

Get the minimum value from fa if not empty

Attributes

Source
PartiallyOrderedSetLaws.scala
def removeMin[A](fa: F[A])(implicit order: Order[A]): F[A]

Remove the minimum value if fa is not empty, else return empty

Remove the minimum value if fa is not empty, else return empty

Attributes

Source
PartiallyOrderedSetLaws.scala
def singleton[A](a: A): F[A]

make an f with a single item

make an f with a single item

Attributes

Source
PartiallyOrderedSetLaws.scala
def unorderedFoldMap[A, B : CommutativeMonoid](fa: F[A])(fn: A => B): B

Attributes

Source
PartiallyOrderedSetLaws.scala

Inherited methods

def addAll[A](fa: F[A], items: Iterable[A])(implicit order: Order[A]): F[A]

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def addAllLargest[A](fa: F[A], maxSize: Long, items: Iterable[A])(implicit order: Order[A]): F[A]

same as items.foldLeft(fa)(addIfLarger(_, count, _))

same as items.foldLeft(fa)(addIfLarger(_, count, _))

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def addIfLarger[A](fa: F[A], maxSize: Long, item: A)(implicit order: Order[A]): F[A]

same as takeLargest(add(fa, item), maxSize)

same as takeLargest(add(fa, item), maxSize)

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def build[A](items: Iterable[A])(implicit order: Order[A]): F[A]

build an F from Iterable

build an F from Iterable

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def contains_[A](fa: F[A], v: A)(implicit ev: Eq[A]): Boolean

Tests if fa contains v using the Eq instance for A

Tests if fa contains v using the Eq instance for A

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala
def count[A](fa: F[A])(p: A => Boolean): Long

Count the number of elements in the structure that satisfy the given predicate.

Count the number of elements in the structure that satisfy the given predicate.

For example:

scala> import cats.syntax.all._
scala> val map1 = Map[Int, String]()
scala> val p1: String => Boolean = _.length > 0
scala> UnorderedFoldable[Map[Int, *]].count(map1)(p1)
res0: Long = 0

scala> val map2 = Map(1 -> "hello", 2 -> "world", 3 -> "!")
scala> val p2: String => Boolean = _.length > 1
scala> UnorderedFoldable[Map[Int, *]].count(map2)(p2)
res1: Long = 2

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala
def exists[A](fa: F[A])(p: A => Boolean): Boolean

Check whether at least one element satisfies the predicate.

Check whether at least one element satisfies the predicate.

If there are no elements, the result is false.

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala
def forall[A](fa: F[A])(p: A => Boolean): Boolean

Check whether all elements satisfy the predicate.

Check whether all elements satisfy the predicate.

If there are no elements, the result is true.

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala
def isEmpty[A](fa: F[A]): Boolean

Returns true if there are no elements.

Returns true if there are no elements. Otherwise false.

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala
def nonEmpty[A](fa: F[A]): Boolean

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala
def order[A : Order]: Order[F[A]]

Given an Order[A] we can always make an Order[F[A]]

Given an Order[A] we can always make an Order[F[A]]

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def pop[A](fa: F[A])(implicit order: Order[A]): Option[(A, F[A])]

Same as get the minimimumOption and removinging the minimum

Same as get the minimimumOption and removinging the minimum

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def size[A](fa: F[A]): Long

The size of this UnorderedFoldable.

The size of this UnorderedFoldable.

This is overridden in structures that have more efficient size implementations (e.g. Vector, Set, Map).

Note: will not terminate for infinite-sized collections.

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala
def sortedFoldLeft[A, B](fa: F[A], init: B)(fn: (B, A) => B)(implicit order: Order[A]): B

fold in order

fold in order

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def takeLargest[A](fa: F[A], maxSize: Long)(implicit order: Order[A]): F[A]

remove as many as needed until size <= maxSize

remove as many as needed until size <= maxSize

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala
def toSortedList[A](fa: F[A])(implicit order: Order[A]): List[A]

return a sorted list of all items in fa

return a sorted list of all items in fa

Attributes

Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala

Attributes

Inherited from:
UnorderedFoldable
Source
UnorderedFoldable.scala

Deprecated and Inherited methods

def unadd[A](fa: F[A])(implicit order: Order[A]): Option[(A, F[A])]

Same as get the minimimumOption and removinging the minimum

Same as get the minimimumOption and removinging the minimum

Attributes

Deprecated
true
Inherited from:
PartiallyOrderedSet
Source
PartiallyOrderedSet.scala