List for Processing
Pack is the most ubiquitous immutable collection, like scala.List
Unlike List, Pack is mostly backed by Array and can be specialized
Usually Pack has smaller memory footprint and in most cases is faster to manipulate data
Def
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 Pack to a longer term variable, it might be usefull to run compact if memory is a concern
val list = (1 <> 1_000_000).~.drop(_ % 100 == 0).><.compact
Note. compact can be called multiple times, but will do anything only if Pack is not compacted
- Source
- __.scala
Range reversed filter
Range reversed filter
Creates a new Pack from current Pack, skipping elements within given range
- Source
- __.scala
Range reversed filter
Range reversed filter
Creates a new Pack from current Pack, skipping elements within given range
- Source
- __.scala
Head reversed filter
Head reversed filter
Creates a new Pack from current Pack, skipping given number of first elements
- Source
- __.scala
Tail reversed filter
Tail reversed filter
Creates a new Pack from current Pack, skipping given number of last elements
- Source
- __.scala
First optional element
First optional element
Returns first elements or empty option for empty Pack
- Source
- __.scala
Join value
Join value
Creates a new Pack with given value appended to the end of current Pack
- Source
- __.scala
Join stream
Join stream
Creates a new Pack with given stream values appended to the end of current Pack
- Source
- __.scala
Join stream at position
Join stream at position
Creates a new Pack with given stream values inserted into current Pack at given position
- Source
- __.scala
Join value at position
Join value at position
Creates a new Pack with given value inserted into current Pack at given position
- Source
- __.scala
Specialize
Specialize
This operation will not compile for reference types
Returns specialized List for undelying primitive type
Note: If this instance is already specialized, it is returned as as
- Source
- __.scala
Range filter
Range filter
Creates a new Pack from current Pack, taking only elements within given range
- Source
- __.scala
Range filter
Range filter
Creates a new Pack from current Pack, taking only elements within given range
- Source
- __.scala
Head filter
Head filter
Creates a new Pack from current Pack, taking only given number of first elements
- Source
- __.scala
Tail filter
Tail filter
Creates a new Pack from current Pack, taking only given number of last elements
- Source
- __.scala