Set

abstract class Set[A] extends Collection[A] with Able.Contain[A]

Set is an immutable collection with no duplicate values

When an element is joined to a Set, it is evaluated for uniqueness and the operation is ignored in case of duplicates.

Note: Set is a concrete single implementation of unique collection. There is no general "Set" interface, because its use is rare. If there is a need for more efficient "Set" functionality, create one with Collection.Mutable.noDuplicates. The result is faster, but is not thread safe.

Source
__.scala
trait Able.Contain[Set.A]
trait Collection[Set.A]
trait Able.Size
trait Able.Stream[Set.A]
class java.lang.Object
trait scala.Matchable
class Any
class Byte.G.Set[Byte.G.Set.A]
class Char.G.Set[Char.G.Set.A]
class Int.G.Set[Int.G.Set.A]
class Long.G.Set[Long.G.Set.A]
class Short.G.Set[Short.G.Set.A]

Def

@targetName("join")
inline def +(v: A): this.type

Alias for join

Alias for join

If given value does not exist in current collection, a new Set is created with this value

 var set: Set[Int]=VOID

 set = set + 1 + 2 + 3 + 1 + 2 + 3

 set.stream.tp  // Prints Stream(1, 2, 3)
Source
__.scala
@targetName("joinAll")
inline def ++(v: Stream[A]): this.type

Alias for joinAll

Alias for joinAll

Creates a Set with a stream of only unique elements joined in

 var set: Set[Int]=VOID

 set = set ++ (1 <> 5) ++ (3 <> 8) ++ (5 <> 10)

 set.stream.sort.tp  // Prints Stream(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Source
__.scala
def contains(v: A): Boolean
Source
__.scala
def join(v: A): this.type

Join element

Join element

If given value does not exist in current collection, a new Set is created with this value

 var set: Set[Int]=VOID

 set = set.join(1).join(1).join(2).join(2).join(3).join(3)

 set.stream.tp  // Prints Stream(1, 2, 3)
Source
__.scala
def joinAll(v: Stream[A]): this.type

Join stream of elements

Join stream of elements

Creates a Set with a stream of only unique elements joined in

 var set: Set[Int]=VOID

 set = set.joinAll(1 <> 5).joinAll(3 <> 8).joinAll(5 <> 10)

 set.stream.sort.tp  // Prints Stream(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Source
__.scala
def size: Int
Inherited from
Collection
Source
__.scala
def stream: Stream[A]

Stream elements

Stream elements

Returns a stream of all collection elements

Unless specifically defined, the order must be assumed as random

  val c = Collection(1,3,5,7)
  c.stream.tp

  // Output
  Stream(1, 3, 5, 7)
Inherited from
Collection
Source
__.scala