public class IntegerBuffer
extends java.lang.Object
No attempt has been made to make this class thread-safe at all. The append methods and indexOf are not too efficient either, but work for what we need.
Constructor | Description |
---|---|
IntegerBuffer() |
Creates a new buffer.
|
IntegerBuffer(int capacity) |
Creates a new buffer with the given initial capacity.
|
Modifier and Type | Method | Description |
---|---|---|
void |
append(int i) |
Appends a single int.
|
void |
append(int[] i) |
Appends an array of ints.
|
int |
capacity() |
Returns the current capacity (the size the buffer can use
before it needs to grow).
|
int |
indexOf(int[] sequence) |
finds sequence in current buffer.
|
int |
size() |
Returns the current size.
|
int[] |
toIntArray() |
Returns an arry view of this buffer's content.
|
public IntegerBuffer()
public IntegerBuffer(int capacity)
public int size()
public int capacity()
public void append(int i)
public void append(int[] i)
public int[] toIntArray()
public int indexOf(int[] sequence)