IntBuffer

final class IntBuffer(initialSize: Int) extends ArrayBufferLike[Int]
Growable, mutable array of integers.
Companion
object
trait ArrayBufferLike[Int]
trait Buffer[Int]
trait Int => Int
class Object
trait Matchable
class Any

Document{}

@inline
final def last: T
Returns value at the zero index.
Inhertied from
Buffer
final def replaceFromIterator(index: Int, numberOfValues: Int, iterator: Iterator[T]): Buffer
Replaces current values in the range [index, index + min(iterator.length, replaceLength) )
with values returned from the iterator.
Inhertied from
Buffer
final override def replaceFromSlice(index: Int, slice: Slice[T]): ArrayBufferLike
Replaces current values in the range [index, index + slice.length) with values of the slice.
Definition Classes
Inhertied from
ArrayBufferLike
final def insertFromIterator(index: Int, numberOfValues: Int, iterator: Iterator[T]): Buffer
Shift current content to the right starting from indexat the min(iterator.length, insertLength) distance,
and inserts iterated values into the gap.
- Sets topIndex to be at least at the end of the new chunk of values.
Inhertied from
Buffer
final def insertFromIterator(index: Int, iterator: Iterator[T]): Buffer
Inserts iterated values into the gap made by shiftjng buffer right, starting from the index.
- Sets topIndex to be at least at the end of the new chunk of values.
Inhertied from
Buffer
@inline
final def appendIterable(iterable: Iterable[T]): Buffer
Appends values from the given iterable at the end of the buffer and advances topIndex.
Inhertied from
Buffer
final def set(index: Int): Buffer
Sets topIndex value.
Inhertied from
Buffer
final def forward(distance: Int): Buffer
Moves topIndex value right by the distance.
Inhertied from
Buffer
@inline
final def lastOption: Option[T]
Returns Some value at the zero index,
or None if empty buffer.
Inhertied from
Buffer
@inline
final def top: Int
Returns topIndex value.
Inhertied from
Buffer
@inline
final def init: Buffer
Returns this buffer without a first element.
Inhertied from
Buffer
@inline
final def push(value: T): Buffer
Appends value to the topIndex.
Same as append
Inhertied from
Buffer
@inline
final def tail: Buffer
Returns this buffer after decrementing topIndex .
Inhertied from
Buffer
@inline
final def map[K](f: T => K): Iterable[K]
Iterable representing lazily mapped values of this buffer at the time of access.
Value Params
f
map function
Inhertied from
Buffer
final override def replaceFromArray(index: Int, sourceIndex: Int, replaceLength: Int, sourceArray: Array[T]): ArrayBufferLike
Replaces current values in the range [index, index + replaceLength)
with values of the array range [sourceIndex, sourceIndex + replaceLength).
Definition Classes
Inhertied from
ArrayBufferLike
final def insert(index: Int, value: T): Buffer
Shifts content in [index, length) one step to the right and updates value at index.
Inhertied from
Buffer
@inline
final def append(value: T): Buffer
Appends value at the end of the buffer and advances topIndex.
Inhertied from
Buffer
final override def shiftRight(index: Int, distance: Int): ArrayBufferLike
Moves values [index, length) right to [index+distance, length + distance).
Effectively creates a new range [index, index+distance).
Ignores negative distance.
Does not clear existing values inside [index, index+distance).
Moves topIndex if affected.
Definition Classes
Inhertied from
ArrayBufferLike
@inline
final def appendSlice(slice: Slice[T]): Buffer
Appends values from the given slice at the end of the buffer and advances topIndex.
Inhertied from
Buffer
final def iterator: Iterator[T]
Returns an iterator over actual buffer values,
starting from the zero index up.
Note
does not copy buffer values,
Inhertied from
Buffer
@inline
final def headOption: Option[T]
Returns Some value at the topIndex
or None if empty buffer.
Inhertied from
Buffer
@inline
final def peek(offset: Int): T
Returns value at the topIndex - offset.
Inhertied from
Buffer
@inline
final def peek: T
Returns value at the topIndex.
Inhertied from
Buffer
final def modifyAllWhen(map: T => T, pred: T => Boolean): Buffer
Updates all accepted values in the range [0,length) using the function.
Value Params
map
map function
pred
filter function
Inhertied from
Buffer
final def reset: Int
Resets buffer, sets topIndex to -1.
- Does not clear existing values.
Returns
previous topIndex
Inhertied from
Buffer
@inline
final def isEmpty: Boolean
Is the accessible part of the buffer empty?
Inhertied from
Buffer
final def trim(size: Int): Buffer
Trims the buffer, if needed, to have at most the size.
Inhertied from
Buffer
final def reverseIterator: Iterator[T]
Returns a reverse iterator over actual buffer values,
starting from the topIndex down.
Inhertied from
Buffer
final def modifyAll(map: T => T): Buffer
Updates all values in the range [0,length) using the function.
Value Params
map
map function
Inhertied from
Buffer
final def insertFromIteratorReverse(index: Int, numberOfValues: Int, iterator: Iterator[T]): Buffer
Shift current content to the right starting from indexat the min(iterator.length, insertLength) distance,
and inserts iterated values into the gap in the reverse order.
- Sets topIndex to be at least at the end of the new chunk of values.
Inhertied from
Buffer
final def insertFromIteratorReverse(index: Int, iterator: Iterator[T]): Buffer
Inserts iterated values, in the reverse order, into the gap made by shiftjng buffer right, starting from the index.
- Sets topIndex to be at least at the end of the new chunk of values.
Inhertied from
Buffer
@inline
final def get(index: Int): Option[T]
Returns Some value at the index, or None if index outside of range.
Inhertied from
Buffer
final override def insertArray(index: Int, sourceIndex: Int, insertLength: Int, sourceArray: Array[T]): ArrayBufferLike
Shift current content to the right starting from indexat the insertLength distance,
and copies array chunk into the gap.
Sets topIndex to be at least at the end of the new chunk of values.
Definition Classes
Inhertied from
ArrayBufferLike
@inline
final def appendSequence(values: IndexedSeq[T]): Buffer
Appends values from the given sequence at the end of the buffer and advances topIndex.
Inhertied from
Buffer
final override def moveRangeLeft(fromIndex: Int, toIndex: Int, distance: Int): ArrayBufferLike
Moves values in [fromIndex,toIndex) to the left at a distance,
to become [fromIndex - distance, toIndex - distance),
and moves right any existing values in [fromIndex - distance, fromIndex)
to become [toIndex - distance, toIndex).
Shifts right first if distance > fromIndex.
Ignores negative distance and values outside of [0,length).
Moves topIndex if affected.
Definition Classes
Inhertied from
ArrayBufferLike
@inline
final def appendFromIterator(numberOfValues: Int, iterator: Iterator[T]): Buffer
Appends number of values from the given iterator at the end of the buffer and advances topIndex.
Inhertied from
Buffer
final def appendFromIterator(iterator: Iterator[T]): Buffer
Appends values from the given iterator at the end of the buffer and advances topIndex.
Inhertied from
Buffer
@inline
final def appendArray(values: Array[T]): Buffer
Appends values from the given array at the end of the buffer and advances topIndex.
Inhertied from
Buffer
final def replaceFromIteratorReverse(index: Int, numberOfValues: Int, iterator: Iterator[T]): Buffer
Replaces current values in the range [index, index + min(iterator.length, replaceLength))
with values returned from the iterator in the reverse order.
Inhertied from
Buffer
final def modifyRange(fromIndex: Int, toIndex: Int, map: T => T): Buffer
Updates values in the range [startIndex,toIndex)^^[0,length) using the function.
One of {startIndex,toIndex} must fall within range [0,length).
Value Params
fromIndex
index of the first value inclusive
map
map function
toIndex
index of the last value exclusive
Throws
IndexOutOfBoundsException
IndexOutOfBoundsException
Inhertied from
Buffer
final def insertValues(index: Int, sourceIndex: Int, numberOfValues: Int, source: Int => T): Buffer
Shift current content to the right starting from indexat the insertLength distance,
iterates over the source indexes and copies values into the gap.
- Sets topIndex to be at least at the end of the new chunk of values.
Inhertied from
Buffer
@inline
final def removeRange(fromIndex: Int, toIndex: Int): Buffer
Removes values in the range [fromIndex, toIndex) and shifts content in [toIndex, length) to the left.
Inhertied from
Buffer
final def touch(index: Int): Buffer
Sets topIndex value if lower than index,
otherwise keeps existing.
Inhertied from
Buffer
final def replaceValues(index: Int, sourceIndex: Int, numberOfValues: Int, source: Int => T): Buffer
Replaces current values in the range [index, index + replaceLength) with values returned by the function
when iterating argument in the range [sourceIndex, sourceIndex + replaceLength).
Inhertied from
Buffer
@inline
final def removeWhen(pred: T => Boolean): Buffer
Removes values matching the predicate.
Inhertied from
Buffer
final def pop: T
Returns value at the topIndex, and moves topIndex back.
Inhertied from
Buffer
@inline
final def remove(index: Int): Buffer
Removes value at index and shifts content in [index+1, length) to the left.
Inhertied from
Buffer
final def rewind(distance: Int): Buffer
Moves topIndex value left by the distance.
Inhertied from
Buffer
@inline
final def nonEmpty: Boolean
Is the accessible part of the buffer non empty?
Inhertied from
Buffer
final override def moveRangeRight(fromIndex: Int, toIndex: Int, distance: Int): ArrayBufferLike
Moves values in [fromIndex,toIndex) to the right at a distance,
to become [fromIndex + distance, toIndex + distance),
and moves left any existing values in [toIndex, toIndex + distance)
to become [fromIndex, fromIndex + distance).
Ignores negative distance and values outside of [0,length).
Moves topIndex if affected.
Definition Classes
Inhertied from
ArrayBufferLike
final def modifyRangeWhen(fromIndex: Int, toIndex: Int, map: T => T, pred: T => Boolean): Buffer
Updates values in the range [startIndex,toIndex)^^[0,length) using the function.
One of {startIndex,toIndex} must fall within range [0,length).
Value Params
fromIndex
index of the first value inclusive
map
map function
pred
filter function
toIndex
index of the last value exclusive
Throws
IndexOutOfBoundsException
IndexOutOfBoundsException
Inhertied from
Buffer
final def modify(index: Int, map: T => T): Buffer
Updates value at the provided index using the function.
Index must fall within range [0,length).
Value Params
index
value's index
map
map function
Throws
IndexOutOfBoundsException
IndexOutOfBoundsException
Inhertied from
Buffer
@inline
final def length: Int
Length of the accessible part of the buffer.
Inhertied from
Buffer
final def store(value: T): Buffer
Replace value at the topIndex.
Inhertied from
Buffer
@inline
final def peekOption(offset: Int): Option[T]
Returns value at the topIndex - offset.
Inhertied from
Buffer
final override def insertSlice(index: Int, slice: Slice[T]): ArrayBufferLike
Shift current content to the right starting from index at the slice.length distance,
and copies slice content into the gap.
Sets topIndex to be at least at the end of the new chunk of values.
Definition Classes
Inhertied from
ArrayBufferLike
final override def update(index: Int, value: T): ArrayBufferLike
Updates value at the provided index.
Alters underlying array if necessary.
Throws
IndexOutOfBoundsException
IndexOutOfBoundsException
Definition Classes
Inhertied from
ArrayBufferLike
final def swap(first: Int, second: Int): Buffer
Swap two values at the provided indexes.
Value at first becomes value at second, and vice versa.
- Does nothing if any index falls outside [0,length) or if indexes are equal.
Inhertied from
Buffer
final override def shiftLeft(index: Int, distance: Int): ArrayBufferLike
Moves values [index, length) left to [index-distance, length - distance). Effectively removes range (index-distance, index] .
Ignores negative distance.
Moves topIndex if affected.
Definition Classes
Inhertied from
ArrayBufferLike
@inline
final def mapInPlace(f: T => T): Buffer
Updates in-place all values in the range [0,length) using the function.
Value Params
f
map function
Inhertied from
Buffer
final override def swapRange(first: Int, second: Int, swapLength: Int): ArrayBufferLike
Swap values in range [first, first + swapLength) with values in range [second, second + swapLength]
- Does nothing if any index falls outside [0,length), or if indexes are equal.
- if [first, first + swapLength) overlaps with [second, second + swapLength)
then the later overwrites the former.
Definition Classes
Inhertied from
ArrayBufferLike

Value members

Methods

override def apply(index: Int): Int
Returns value at the given index or 0 if out of scope.
Definition Classes
Buffer -> Function1
def increment(index: Int): IntBuffer
Increments the value at an index
def decrement(index: Int): IntBuffer
Decrements the value at an index
override def copy: IntBuffer
Definition Classes
override def emptyCopy: IntBuffer
Definition Classes
override def toArray[T1 >: Int](evidence$1: ClassTag[T1]): Array[T1]
Returns a trimmed copy of an underlying array.
Definition Classes
override def asArray: Array[Int]
Returns an Array with a copy of an accessible buffer range.
Definition Classes
override def asSlice: IntSlice
Wraps accessible internal state as a Slice without making any copy.
Definition Classes
override def slice(from: Int, to: Int): IntSlice
Takes range and returns an IntSlice.
Definition Classes

Inherited methods

@unspecialized
def compose[A](g: A => T1): A => R
Inhertied from
Function1
final def contains(value: T): Boolean
Returns true if buffer contains given value.
Inhertied from
Buffer
final def exists(pred: T => Boolean): Boolean
Returns true if buffer contains value fulfilling the predicate.
Inhertied from
Buffer
@unspecialized
def andThen[A](g: R => A): T1 => A
Inhertied from
Function1
final override def toString: String
Definition Classes
ArrayBufferLike -> Function1 -> Any
Inhertied from
ArrayBufferLike
final override def optimize(): ArrayBufferLike
Attempts to optimize buffer storage, if needed.
Definition Classes
Inhertied from
ArrayBufferLike