Idx

trait Idx[+A] extends Collection[A]

Indexed Collection

Elements in Idx can be efficiently accessed with Int index starting from 0

The immutable implementation of Idx is Pack

Source
__.scala
trait Collection[Idx.A]
trait Able.Size
trait Able.Stream[Idx.A]
class java.lang.Object
trait scala.Matchable
class Any
trait J.Array
class Pack[Pack.A]
class Boolean.G.Pack[Boolean.G.Pack.A]
class Byte.G.Pack[Byte.G.Pack.A]
class Char.G.Pack[Char.G.Pack.A]
class Double.G.Pack[Double.G.Pack.A]
class Float.G.Pack[Float.G.Pack.A]
class Int.G.Pack[Int.G.Pack.A]
class Long.G.Pack[Long.G.Pack.A]
class Short.G.Pack[Short.G.Pack.A]
trait Idx.Mutable[Idx.Mutable.A]
trait Idx.ObservableMutable[Idx.ObservableMutable.A]
class Idx.ObservableMutable.X.Abstract[Idx.ObservableMutable.X.Abstract.A]
class Idx.ObservableMutable.X.Basic[Idx.ObservableMutable.X.Basic.A]
class Idx.Mutable.X.Abstract[Idx.Mutable.X.Abstract.A]
class Idx.Observable.Event.Recorder[Idx.Observable.Event.Recorder.A]
trait Idx.Observable[Idx.Observable.A]
class Idx.Observable.X.Abstract[Idx.Observable.X.Abstract.A]
trait Idx.Observable.X.Base[Idx.Observable.X.Base.A]
trait Idx.Selection[Idx.Selection.A]
trait Idx.Selection.Observable[Idx.Selection.Observable.A]
class Idx.X.Abstract[Idx.X.Abstract.A]

Def

def apply(i: Int): A

Returns element at specified position

Returns element at specified position

 val idx: Idx[Char] = ('A' <> 'Z').stream.pack

 idx(1).tp // Prints: B

 idx(4).tp // Prints: E
Source
__.scala
def size: Int
Source
__.scala
def stream: Stream[A]

Returns a Stream of all elements

Returns a Stream of all elements

The element order is same as in the Idx itself

  val l: Idx[Char] = ('a' <> 'g').stream.pack

  l.stream.tp  // Prints Stream(a, b, c, d, e, f, g)
Source
__.scala

Extension

def applyOpt[A](position: Int): Opt[A]
Source
__.scala
def contains[A](v: A): Boolean
Source
__.scala
def head[A]: A

First element

First element

Returns first elements or fails for empty Idx

Use headOpt for safer access

Source
__.scala
def headOpt[A]: Opt[A]

First optional element

First optional element

Returns first elements or empty option for empty Idx

Source
__.scala
def last[A]: A
Source
__.scala
def lastOpt[A]: Opt[A]
Source
__.scala
def mapView[A](f: A => B): Idx[B]
Source
__.scala
def orderedContains[A](v: A)(using Ordering[A]): Boolean
Source
__.scala
def orderedSearch[A](v: A, max: Int)(using Ordering[A]): Int.Range
Source
__.scala
def orderedSearchBy[A](map: A => B, v: B, max: Int, extraFilter: A => Boolean)(using Ordering[B]): Int.Range
Source
__.scala
def rangeView[A](r: Int.Range): Idx[A]
Source
__.scala
def reversedView[A]: Idx[A]
Source
__.scala
def tail[A]: Idx[A]

Idx without first element

Idx without first element

The returned tail can be empty

Note. This operation creates a tail "view" of target Idx, so target mutations may cause problem

Source
__.scala
def toJavaListView[A]: java.util.List[A]
Source
__.scala
def toProductView[A]: scala.Product
Source
__.scala
def toSeqView[A]: scala.collection.immutable.IndexedSeq[A]
Source
__.scala