sealed trait Int2List extends Serializable
A growable, immutable linked list based data store for int values except Int.MinValue
.
Though this data store is backed by a linked list, it is not a classical linked list and it
does not offer (efficient) head and tail operations. However, compared to a classical linked
list the memory usage is reduced by ~33% and a simple foreach is also ~17% faster, the time
to create the list is comparable and iteration using an Iterator is marginally slower if at all.
The basic idea is to two store 2 values in each node of the linked list to reduce the overhead
incurred by the creation of the objects.
This list does not perform any length related checks. I.e., it fails,e.g., in
case of forFirstN
if the size of the list is smaller than expected.
Furthermore, all directly implemented methods use while
loops for maximum
efficiency and the list is also specialized for primitive int
values which
makes this list far more efficient when used for storing lists of int
values.
- Self Type
- Int2List
- Source
- Int2List.scala
- Alphabetic
- By Inheritance
- Int2List
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def +:(v: Int): Int2List
Prepends the given value to this list.
Prepends the given value to this list. E.g.,
l = 2 +: l
. - abstract def equals(that: Int2List): Boolean
- abstract def forFirstN[U](n: Int)(f: (Int) => U): Unit
Iterates over the first N values.
- abstract def foreach[U](f: (Int) => U): Unit
- abstract def isEmpty: Boolean
- abstract def isSingletonList: Boolean
- abstract def iterator: IntIterator
- returns
An iterator over this list's values. In general, you should prefer using foreach or the other specialized methods to avoid the overhead incurred by the generation of the iterator.
- abstract def nonEmpty: Boolean
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def equals(other: Any): Boolean
- Definition Classes
- Int2List → AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated