Bag

com.phasmidsoftware.gryphon.core.Bag
See theBag companion trait
object Bag

Provides factory methods for creating instances of Bag.

A Bag is an unordered collection that allows duplicate elements. This object serves as the companion object to the Bag type, offering utility functions to create empty or populated Bag instances.

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Bag.type

Members list

Value members

Concrete methods

def create[X](xs: X*): Bag[X]

Creates a new Bag instance populated with the specified elements.

Creates a new Bag instance populated with the specified elements.

Value parameters

xs

the elements to populate the created Bag with. These elements are variable-length arguments that allow creating a Bag with one or more elements.

Attributes

Returns

a new Bag[X] instance containing the provided elements.

def empty[X]: Bag[X]

Creates an empty Bag instance.

Creates an empty Bag instance.

This method provides a convenient way to obtain a Bag without any elements. The returned Bag is immutable and can be used as a starting point for adding elements.

Attributes

Returns

an empty Bag of type Bag[X].

Implicits

Implicits

implicit val random: Random