public class IntArrayContainer extends Object
Constructor and Description |
---|
IntArrayContainer(int initialCapacity)
Constructs a new int array container with the specified initial backing array size.
|
Modifier and Type | Method and Description |
---|---|
int[] |
copy()
Returns a copy of the elements in use.
|
void |
fill(int[] otherArray)
Overwrites values from the supplied array into this array.
|
void |
fill(IntArrayContainer other)
Overwrites values in this array with the supplied array.
|
void |
grow(int requestedSize)
Grows the backing array, copying the elements.
|
static void |
merge(IntArrayContainer input,
int[] otherArray,
IntArrayContainer output)
Merges input and otherArray writing to output.
|
static int[] |
merge(List<int[]> input,
IntArrayContainer firstBuffer,
IntArrayContainer secondBuffer)
Merges the list of int arrays into a single int array, using the two supplied buffers.
|
static void |
removeOther(IntArrayContainer input,
int[] otherArray,
IntArrayContainer output)
Copies from input to output excluding the values in otherArray.
|
public IntArrayContainer(int initialCapacity)
initialCapacity
- The initial capacity of the backing array.public void grow(int requestedSize)
requestedSize
- The size to grow the array to.public int[] copy()
public void fill(int[] otherArray)
otherArray
- The array to copy from.public void fill(IntArrayContainer other)
other
- The array to copy from.public static void removeOther(IntArrayContainer input, int[] otherArray, IntArrayContainer output)
This assumes both input and otherArray are sorted. Behaviour is undefined if they aren't.
input
- The input container.otherArray
- Another (sorted) int array.output
- The container to write the output to.public static int[] merge(List<int[]> input, IntArrayContainer firstBuffer, IntArrayContainer secondBuffer)
input
- A list of int arrays.firstBuffer
- A buffer.secondBuffer
- Another buffer.public static void merge(IntArrayContainer input, int[] otherArray, IntArrayContainer output)
input
- The input container.otherArray
- Another (sorted) int array.output
- The container to write the output to.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.