ListDecorator

final class ListDecorator[T](val xs: List[T]) extends AnyVal

Implements filterConserve, zipWithConserve methods on lists that avoid duplication of list nodes where feasible.

Implements filterConserve, zipWithConserve methods on lists that avoid duplication of list nodes where feasible.

class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def &(ys: List[T]): List[T]

Intersection on lists seen as sets

Intersection on lists seen as sets

final def eqElements(ys: List[AnyRef]): Boolean
def filterConserve(p: T => Boolean): List[T]

Like xs filter p but returns list xs itself - instead of a copy - if p is true for all elements.

Like xs filter p but returns list xs itself - instead of a copy - if p is true for all elements.

final def hasSameLengthAs[U](ys: List[U]): Boolean
def mapWithIndexConserve[U <: T](f: (T, Int) => U): List[U]

Like xs.lazyZip(xs.indices).map(f), but returns list xs itself

Like xs.lazyZip(xs.indices).map(f), but returns list xs itself

  • instead of a copy - if function f maps all elements of xs to themselves.
final def mapconserve[U](f: T => U): List[U]
def zipWithConserve[U](ys: List[U])(f: (T, U) => T): List[T]

Like xs.lazyZip(ys).map(f), but returns list xs itself

Like xs.lazyZip(ys).map(f), but returns list xs itself

  • instead of a copy - if function f maps all elements of xs to themselves. Also, it is required that ys is at least as long as xs.
def |(ys: List[T]): List[T]

Union on lists seen as sets

Union on lists seen as sets

Concrete fields

val xs: List[T]