Whether the view has no values (Java: isEmpty()).
Time: O(1).
The number of values (Java: size()).
Time: O(1).
Returns an iterator over the values, in ascending order (Java: iterator(); the list
iterator and the spliterator have no counterpart).
Time: O(1) to create the iterator.
Returns the values as an Int32Array that views the array of this view, without a copy. This
is the bridge to code that takes typed arrays. It is not in Java, where the view is itself an
IntList.
The result must not be modified, like the arrays of Csr: it shares its memory with the graph or the result the view comes from.
Time: O(1).
Returns whether the view contains value.
Time: O(log size).
Returns whether other is a list with the same values in the same order, as the
java.util.List contract defines it. A list is another view, an Array or a typed array.
Time: O(size).
Calls action for every value, in ascending order.
Time: O(size).
Returns a hash code over the values, as the java.util.List contract defines it. It has the
same value as in Java.
Time: O(size).
Returns the position of value, or -1 if the view does not contain it.
Time: O(log size).
the value to search for
position in 0..size-1, or -1
Returns the position of value, or -1 if the view does not contain it. Equivalent to
SortedIntView.indexOf, since no value occurs twice.
Time: O(log size).
Returns the values at the positions fromIndex..toIndex-1 as a view of the same array, not a
copy.
Time: O(1).
first position
end position, exclusive
Returns the values in dest from position 0 on, or in a new array if dest is null,
missing or too short.
Time: O(size). Memory: 4 x size bytes if it returns a new array, otherwise none.
Optionaldest: Int32Array<ArrayBufferLike> | null
the array to fill, or null or none for a new one
dest, or a new array
Returns the values as a new array (Java: toIntArray).
Time: O(size). Memory: 4 x size bytes for the result.
Returns the values as Java's lists write them: [1, 2, 3].
Returns the values of this view and other together, in ascending order and without
duplicates.
The result is a copy, merged on every call, unless one of the two views is empty: then it is the other one.
Time: O(size + other.size). Memory: up to 4 x (size + other.size) bytes for the result; while it runs, up to as much again if the two views share values.
the view to unite with this one
the union
StaticviewReturns a view of array[fromIndex..toIndex-1], which must be strictly ascending.
The range is checked, not copied: the view shares array, and stays sorted and unchanged only
as long as nobody modifies that range of it.
Time: O(toIndex - fromIndex).
the array to view
first position of the range
end position of the range, exclusive
a view of the range
A list of
intvalues in ascending order and without duplicates, as a view of a range of anInt32Array.Adjacency lookups such as Graph.outNodes return it, as do other methods of this library that return nodes or edge indices in ascending order, such as Graphs.reachableFrom. It reads like a list, with SortedIntView.get and SortedIntView.size. It is also iterable:
for (const node of graph.outNodes(v)). Since its values are sorted and distinct, SortedIntView.indexOf and SortedIntView.contains search in O(log size), and SortedIntView.first and SortedIntView.last are the smallest and the largest value. A loop that must not create an iterator readssizeandget(i), or the arrays of Csr directly.A view shares its array with the object it comes from instead of copying it; a method that returns a copy, such as SortedIntView.union, says so. Instances are immutable, as the arrays behind them never change. A view that SortedIntView.viewOf makes of an array of the caller stays sorted and unchanged only as long as nobody modifies that range of the array. A view is a plain object of three fields rather than a
subarrayof anInt32Array, which costs several times as much to create.Memory: constant; the values stay in the shared array.