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

Value members

Concrete methods

override def apply(index: Int): Int

Returns value at the given index or 0 if out of scope.

Returns value at the given index or 0 if out of scope.

Definition Classes
Buffer -> Function1
override def asArray: Array[Int]

Returns an Array with a copy of an accessible buffer range.

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.

Wraps accessible internal state as a Slice without making any copy.

Definition Classes
override def copy: IntBuffer
Definition Classes
def decrement(index: Int): IntBuffer

Decrements the value at an index

Decrements the value at an index

override def emptyCopy: IntBuffer
Definition Classes
def increment(index: Int): IntBuffer

Increments the value at an index

Increments the value at an index

override def slice(from: Int, to: Int): IntSlice

Takes range and returns an IntSlice.

Takes range and returns an IntSlice.

Definition Classes
override def toArray[T1 >: Int : ClassTag]: Array[T1]

Returns a trimmed copy of an underlying array.

Returns a trimmed copy of an underlying array.

Definition Classes

Inherited methods

@unspecialized
def andThen[A](g: Int => A): Int => A
Inherited from:
Function1
@inline
final def append(value: Int): IntBuffer

Appends value at the end of the buffer and advances topIndex.

Appends value at the end of the buffer and advances topIndex.

Inherited from:
Buffer
@inline
final def appendArray(values: Array[Int]): IntBuffer

Appends values from the given array at the end of the buffer and advances topIndex.

Appends values from the given array at the end of the buffer and advances topIndex.

Inherited from:
Buffer
@inline
final def appendFromIterator(numberOfValues: Int, iterator: Iterator[Int]): IntBuffer

Appends number of values from the given iterator at the end of the buffer and advances topIndex.

Appends number of values from the given iterator at the end of the buffer and advances topIndex.

Inherited from:
Buffer
final def appendFromIterator(iterator: Iterator[Int]): IntBuffer

Appends values from the given iterator at the end of the buffer and advances topIndex.

Appends values from the given iterator at the end of the buffer and advances topIndex.

Inherited from:
Buffer
@inline
final def appendIterable(iterable: Iterable[Int]): IntBuffer

Appends values from the given iterable at the end of the buffer and advances topIndex.

Appends values from the given iterable at the end of the buffer and advances topIndex.

Inherited from:
Buffer
@inline
final def appendSequence(values: IndexedSeq[Int]): IntBuffer

Appends values from the given sequence at the end of the buffer and advances topIndex.

Appends values from the given sequence at the end of the buffer and advances topIndex.

Inherited from:
Buffer
@inline
final def appendSlice(slice: Slice[Int]): IntBuffer

Appends values from the given slice at the end of the buffer and advances topIndex.

Appends values from the given slice at the end of the buffer and advances topIndex.

Inherited from:
Buffer
@unspecialized
def compose[A](g: A => Int): A => Int
Inherited from:
Function1
final def contains(value: Int): Boolean

Returns true if buffer contains given value.

Returns true if buffer contains given value.

Inherited from:
Buffer
final def exists(pred: Int => Boolean): Boolean

Returns true if buffer contains value fulfilling the predicate.

Returns true if buffer contains value fulfilling the predicate.

Inherited from:
Buffer
final def forward(distance: Int): IntBuffer

Moves topIndex value right by the distance.

Moves topIndex value right by the distance.

Inherited from:
Buffer
@inline
final def get(index: Int): Option[Int]

Returns Some value at the index, or None if index outside of range.

Returns Some value at the index, or None if index outside of range.

Inherited from:
Buffer
@inline
final def head: Int

Returns value at the topIndex.

Returns value at the topIndex.

Inherited from:
Buffer
@inline
final def headOption: Option[Int]

Returns Some value at the topIndex or None if empty buffer.

Returns Some value at the topIndex or None if empty buffer.

Inherited from:
Buffer
@inline
final def init: IntBuffer

Returns this buffer without a first element.

Returns this buffer without a first element.

Inherited from:
Buffer
final def insert(index: Int, value: Int): IntBuffer

Shifts content in [index, length) one step to the right and updates value at index.

Shifts content in [index, length) one step to the right and updates value at index.

Inherited from:
Buffer
final override def insertArray(index: Int, sourceIndex: Int, insertLength: Int, sourceArray: Array[Int]): IntBuffer

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.

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
Inherited from:
ArrayBufferLike
final def insertFromIterator(index: Int, numberOfValues: Int, iterator: Iterator[Int]): IntBuffer

Shift current content to the right starting from indexat the min(iterator.length, insertLength) distance, and inserts iterated values into the gap.

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.
Inherited from:
Buffer
final def insertFromIterator(index: Int, iterator: Iterator[Int]): IntBuffer

Inserts iterated values into the gap made by shiftjng buffer right, starting from the index.

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.
Inherited from:
Buffer
final def insertFromIteratorReverse(index: Int, numberOfValues: Int, iterator: Iterator[Int]): IntBuffer

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.

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.
Inherited from:
Buffer
final def insertFromIteratorReverse(index: Int, iterator: Iterator[Int]): IntBuffer

Inserts iterated values, in the reverse order, into the gap made by shiftjng buffer right, starting from the index.

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.
Inherited from:
Buffer
final override def insertSlice(index: Int, slice: Slice[Int]): IntBuffer

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.

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
Inherited from:
ArrayBufferLike
final def insertValues(index: Int, sourceIndex: Int, numberOfValues: Int, source: Int => Int): IntBuffer

Shift current content to the right starting from indexat the insertLength distance, iterates over the source indexes and copies values into the gap.

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.
Inherited from:
Buffer
@inline
final def isEmpty: Boolean

Is the accessible part of the buffer empty?

Is the accessible part of the buffer empty?

Inherited from:
Buffer
final def iterator: Iterator[Int]

Returns an iterator over actual buffer values, starting from the zero index up.

Returns an iterator over actual buffer values, starting from the zero index up.

Note:

does not copy buffer values,

Inherited from:
Buffer
@inline
final def last: Int

Returns value at the zero index.

Returns value at the zero index.

Inherited from:
Buffer
@inline
final def lastOption: Option[Int]

Returns Some value at the zero index, or None if empty buffer.

Returns Some value at the zero index, or None if empty buffer.

Inherited from:
Buffer
@inline
final def length: Int

Length of the accessible part of the buffer.

Length of the accessible part of the buffer.

Inherited from:
Buffer
@inline
final def map[K](f: Int => K): Iterable[K]

Iterable representing lazily mapped values of this buffer at the time of access.

Iterable representing lazily mapped values of this buffer at the time of access.

Value parameters:
f

map function

Inherited from:
Buffer
@inline
final def mapInPlace(f: Int => Int): IntBuffer

Updates in-place all values in the range [0,length) using the function.

Updates in-place all values in the range [0,length) using the function.

Value parameters:
f

map function

Inherited from:
Buffer
final def modify(index: Int, map: Int => Int): IntBuffer

Updates value at the provided index using the function. Index must fall within range [0,length).

Updates value at the provided index using the function. Index must fall within range [0,length).

Value parameters:
index

value's index

map

map function

Throws:
IndexOutOfBoundsException

if index lower than zero.

Inherited from:
Buffer
final def modifyAll(map: Int => Int): IntBuffer

Updates all values in the range [0,length) using the function.

Updates all values in the range [0,length) using the function.

Value parameters:
map

map function

Inherited from:
Buffer
final def modifyAllWhen(map: Int => Int, pred: Int => Boolean): IntBuffer

Updates all accepted values in the range [0,length) using the function.

Updates all accepted values in the range [0,length) using the function.

Value parameters:
map

map function

pred

filter function

Inherited from:
Buffer
final def modifyRange(fromIndex: Int, toIndex: Int, map: Int => Int): IntBuffer

Updates values in the range [startIndex,toIndex)^^[0,length) using the function. One of {startIndex,toIndex} must fall within range [0,length).

Updates values in the range [startIndex,toIndex)^^[0,length) using the function. One of {startIndex,toIndex} must fall within range [0,length).

Value parameters:
fromIndex

index of the first value inclusive

map

map function

toIndex

index of the last value exclusive

Throws:
IndexOutOfBoundsException

if index lower than zero.

Inherited from:
Buffer
final def modifyRangeWhen(fromIndex: Int, toIndex: Int, map: Int => Int, pred: Int => Boolean): IntBuffer

Updates values in the range [startIndex,toIndex)^^[0,length) using the function. One of {startIndex,toIndex} must fall within range [0,length).

Updates values in the range [startIndex,toIndex)^^[0,length) using the function. One of {startIndex,toIndex} must fall within range [0,length).

Value parameters:
fromIndex

index of the first value inclusive

map

map function

pred

filter function

toIndex

index of the last value exclusive

Throws:
IndexOutOfBoundsException

if index lower than zero.

Inherited from:
Buffer
final override def moveRangeLeft(fromIndex: Int, toIndex: Int, distance: Int): IntBuffer

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.

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
Inherited from:
ArrayBufferLike
final override def moveRangeRight(fromIndex: Int, toIndex: Int, distance: Int): IntBuffer

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.

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
Inherited from:
ArrayBufferLike
@inline
final def nonEmpty: Boolean

Is the accessible part of the buffer non empty?

Is the accessible part of the buffer non empty?

Inherited from:
Buffer
final override def optimize(): IntBuffer

Attempts to optimize buffer storage, if needed.

Attempts to optimize buffer storage, if needed.

Definition Classes
Inherited from:
ArrayBufferLike
@inline
final def peek(offset: Int): Int

Returns value at the topIndex - offset.

Returns value at the topIndex - offset.

Inherited from:
Buffer
@inline
final def peek: Int

Returns value at the topIndex.

Returns value at the topIndex.

Inherited from:
Buffer
@inline
final def peekOption(offset: Int): Option[Int]

Returns value at the topIndex - offset.

Returns value at the topIndex - offset.

Inherited from:
Buffer
final def pop: Int

Returns value at the topIndex, and moves topIndex back.

Returns value at the topIndex, and moves topIndex back.

Inherited from:
Buffer
@inline
final def push(value: Int): IntBuffer

Appends value to the topIndex. Same as append

Appends value to the topIndex. Same as append

Inherited from:
Buffer
@inline
final def remove(index: Int): IntBuffer

Removes value at index and shifts content in [index+1, length) to the left.

Removes value at index and shifts content in [index+1, length) to the left.

Inherited from:
Buffer
@inline
final def removeRange(fromIndex: Int, toIndex: Int): IntBuffer

Removes values in the range [fromIndex, toIndex) and shifts content in [toIndex, length) to the left.

Removes values in the range [fromIndex, toIndex) and shifts content in [toIndex, length) to the left.

Inherited from:
Buffer
@inline
final def removeWhen(pred: Int => Boolean): IntBuffer

Removes values matching the predicate.

Removes values matching the predicate.

Inherited from:
Buffer
final override def replaceFromArray(index: Int, sourceIndex: Int, replaceLength: Int, sourceArray: Array[Int]): IntBuffer

Replaces current values in the range [index, index + replaceLength) with values of the array range [sourceIndex, sourceIndex + replaceLength).

Replaces current values in the range [index, index + replaceLength) with values of the array range [sourceIndex, sourceIndex + replaceLength).

Definition Classes
Inherited from:
ArrayBufferLike
final def replaceFromIterator(index: Int, numberOfValues: Int, iterator: Iterator[Int]): IntBuffer

Replaces current values in the range [index, index + min(iterator.length, replaceLength) ) with values returned from the iterator.

Replaces current values in the range [index, index + min(iterator.length, replaceLength) ) with values returned from the iterator.

Inherited from:
Buffer
final def replaceFromIteratorReverse(index: Int, numberOfValues: Int, iterator: Iterator[Int]): IntBuffer

Replaces current values in the range [index, index + min(iterator.length, replaceLength)) with values returned from the iterator in the reverse order.

Replaces current values in the range [index, index + min(iterator.length, replaceLength)) with values returned from the iterator in the reverse order.

Inherited from:
Buffer
final override def replaceFromSlice(index: Int, slice: Slice[Int]): IntBuffer

Replaces current values in the range [index, index + slice.length) with values of the slice.

Replaces current values in the range [index, index + slice.length) with values of the slice.

Definition Classes
Inherited from:
ArrayBufferLike
final def replaceValues(index: Int, sourceIndex: Int, numberOfValues: Int, source: Int => Int): IntBuffer

Replaces current values in the range [index, index + replaceLength) with values returned by the function when iterating argument in the range [sourceIndex, sourceIndex + replaceLength).

Replaces current values in the range [index, index + replaceLength) with values returned by the function when iterating argument in the range [sourceIndex, sourceIndex + replaceLength).

Inherited from:
Buffer
final def reset: Int

Resets buffer, sets topIndex to -1.

Resets buffer, sets topIndex to -1.

  • Does not clear existing values.
Returns:

previous topIndex

Inherited from:
Buffer
final def reverseIterator: Iterator[Int]

Returns a reverse iterator over actual buffer values, starting from the topIndex down.

Returns a reverse iterator over actual buffer values, starting from the topIndex down.

Inherited from:
Buffer
final def rewind(distance: Int): IntBuffer

Moves topIndex value left by the distance.

Moves topIndex value left by the distance.

Inherited from:
Buffer
final def set(index: Int): IntBuffer

Sets topIndex value.

Sets topIndex value.

Inherited from:
Buffer
final override def shiftLeft(index: Int, distance: Int): IntBuffer

Moves values [index, length) left to [index-distance, length - distance). Effectively removes range (index-distance, index]. Ignores negative distance. Moves topIndex if affected.

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
Inherited from:
ArrayBufferLike
final override def shiftRight(index: Int, distance: Int): IntBuffer

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.

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
Inherited from:
ArrayBufferLike
final def store(value: Int): IntBuffer

Replace value at the topIndex.

Replace value at the topIndex.

Inherited from:
Buffer
final def swap(first: Int, second: Int): IntBuffer

Swap two values at the provided indexes. Value at first becomes value at second, and vice versa.

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.
Inherited from:
Buffer
final override def swapRange(first: Int, second: Int, swapLength: Int): IntBuffer

Swap values in range [first, first + swapLength) with values in range [second, second + swapLength]

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
Inherited from:
ArrayBufferLike
@inline
final def tail: IntBuffer

Returns this buffer after decrementing topIndex .

Returns this buffer after decrementing topIndex .

Inherited from:
Buffer
final override def toString: String
Definition Classes
ArrayBufferLike -> Function1 -> Any
Inherited from:
ArrayBufferLike
@inline
final def top: Int

Returns topIndex value.

Returns topIndex value.

Inherited from:
Buffer
final def touch(index: Int): IntBuffer

Sets topIndex value if lower than index, otherwise keeps existing.

Sets topIndex value if lower than index, otherwise keeps existing.

Inherited from:
Buffer
final def trim(size: Int): IntBuffer

Trims the buffer, if needed, to have at most the size.

Trims the buffer, if needed, to have at most the size.

Inherited from:
Buffer
final override def update(index: Int, value: Int): IntBuffer

Updates value at the provided index. Alters underlying array if necessary.

Updates value at the provided index. Alters underlying array if necessary.

Throws:
IndexOutOfBoundsException

if index lower than zero.

Definition Classes
Inherited from:
ArrayBufferLike