><

abstract class ><[A] extends Idx[A]

>< is Value Pack

>< is the most ubiquitous immutable collection, like List in Scala

Unlike List, >< is mostly backed by an Array and can be specialized. It usually has smaller memory footprint and in most cases is faster to manipulate data.

Source
__.scala
trait Idx[A]
trait Collection[A]
trait Able.Size
trait Able.~[A]
class java.lang.Object
trait scala.Matchable
class Any

Def

@scala.annotation.targetName("stream")
def ~: ~[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').~.><

  l.~.tp  // Prints ~(a, b, c, d, e, f, g)
Inherited from
Idx
Source
__.scala
@scala.annotation.targetName("_join")
inline def +(inline v: A): this.type

Alias for join

Alias for join

Creates a new >< with given value appended to the end of current ><

Source
__.scala
@scala.annotation.targetName("_joinAll")
inline def ++(inline v: ~[A]): this.type

Alias for joinAll

Alias for joinAll

Creates a new >< with given stream values appended to the end of current ><

Source
__.scala
@scala.annotation.targetName("_joinAllAt")
inline def ++@(inline i: Int, inline v: ~[A]): this.type

Alias for joinAllAt

Alias for joinAllAt

Creates a new >< with given stream values inserted into current >< at given position

Source
__.scala
@scala.annotation.targetName("_joinAt")
inline def +@(inline i: Int, inline v: A): this.type

Alias for joinAt

Alias for joinAt

Creates a new >< with given value inserted into current >< at given position

Source
__.scala
def apply(i: Int): A

Returns element at specified position

Returns element at specified position

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

 idx(1).tp // Prints: B

 idx(4).tp // Prints: E
Inherited from
Idx
Source
__.scala
def compact: ><[A]

Optimize storage

Optimize storage

Pack is mostly backed by Array. When created from an unknown size stream, Array within pack can end up with larger capacity than required. Because most Packs are short lived, it is wastfull to copy by default this potentially big array to proper size, but operation compact does exactly this on reqest.

So, when assigning >< to a longer term variable, it might be usefull to run compact if memory is a concern

val pack = (1 <> 1_000_000).~.drop(_ % 100 == 0).><.compact

Note. compact can be called multiple times, but will do anything only if >< is not compacted

Source
__.scala
@scala.annotation.targetName("drop_Range")
def drop_<>(from: Int, size: Int): this.type

Range reversed filter

Range reversed filter

Creates a new >< from current ><, skipping elements within given range

Source
__.scala
@scala.annotation.targetName("drop_Range")
inline def drop_<>(r: Int.<>): this.type

Range reversed filter

Range reversed filter

Creates a new >< from current ><, skipping elements within given range

Source
__.scala
inline def dropFirst(cnt: Int): this.type

Head reversed filter

Head reversed filter

Creates a new >< from current ><, skipping given number of first elements

Source
__.scala
inline def dropLast(cnt: Int): this.type

Tail reversed filter

Tail reversed filter

Creates a new >< from current ><, skipping given number of last elements

Source
__.scala
def head: A

First element

First element

Returns first elements or fails for empty ><

Use head_? for safer access

Source
__.scala
@scala.annotation.targetName("head_Opt")
def head_?: Opt[A]

First optional element

First optional element

Returns first elements or empty option for empty ><

Source
__.scala
override def isEmpty: Boolean

Empty check

Empty check

Returns true if instance is empty.

Definition Classes
Inherited from
Size
Source
Size.scala
def join(v: A): this.type

Join value

Join value

Creates a new >< with given value appended to the end of current ><

Source
__.scala
def joinAll(v: ~[A]): this.type

Join stream

Join stream

Creates a new >< with given stream values appended to the end of current ><

Source
__.scala
def joinAllAt(i: Int, v: ~[A]): this.type

Join stream at position

Join stream at position

Creates a new >< with given stream values inserted into current >< at given position

Source
__.scala
def joinAt(i: Int, v: A): this.type

Join value at position

Join value at position

Creates a new >< with given value inserted into current >< at given position

Source
__.scala
inline def raw[PACK <: ><.RawType[A]](using inline s: Given.PackTag.Raw[A, PACK]): PACK

Specialize

Specialize

This operation will not compile for reference types

Returns specialized pack for undelying primitive type

Note: If this instance is already specialized, it is returned as is

Source
__.scala
override def size: Int

Element count

Element count

Retuns element count

Definition Classes
Inherited from
Idx
Source
__.scala
def tail: ><[A]

Pack without first element

Pack without first element

Note. The returned tail can be empty

Source
__.scala
@scala.annotation.targetName("take_Range")
def take_<>(from: Int, size: Int): this.type

Range filter

Range filter

Creates a new >< from current ><, taking only elements within given range

Source
__.scala
@scala.annotation.targetName("take_Range")
inline def take_<>(r: Int.<>): this.type

Range filter

Range filter

Creates a new >< from current ><, taking only elements within given range

Source
__.scala
inline def takeFirst(cnt: Int): this.type

Head filter

Head filter

Creates a new >< from current ><, taking only given number of first elements

Source
__.scala
inline def takeLast(cnt: Int): this.type

Tail filter

Tail filter

Creates a new >< from current ><, taking only given number of last elements

Source
__.scala
def toBuffer: Buffer[A]

Make Buffer

Make Buffer

Creates a Buffer collection filled with >< elements

Both Buffer and >< are mostly Array based, so the convertions between them are very efficient

Source
__.scala