|
LimeWire Collection Component API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limewire.collection.IntBuffer
public final class IntBuffer
Provides a fixed-size double-ended queue, a circular buffer.
Use IntBuffer when you want to use a fixed amount of resources.
For a minimal amount of efficiency, the internal buffer is only
allocated on the first insertion or retrieval, allowing lots of
int buffers to be created that may not be used.
This class is not thread-safe.
IntBuffer ib = new IntBuffer(10);
for(int i = 0; !ib.isFull(); i++)
ib.add(i);
for(int i = 0; i < ib.size() ; i++)
System.out.println(ib.get(i));
Output:
9
8
7
6
5
4
3
2
1
0
| Constructor Summary | |
|---|---|
IntBuffer(int size)
|
|
IntBuffer(IntBuffer other)
"Copy constructor": constructs a new shallow copy of other. |
|
| Method Summary | |
|---|---|
int |
add(int x)
Same as addFirst(x). |
int |
addFirst(int x)
|
int |
addLast(int x)
|
void |
clear()
|
Object |
clone()
Returns a shallow copy of this, of type IntBuffer |
boolean |
contains(int x)
Returns true if the input object x is in the buffer. |
int |
first()
Returns the head of this, or throws NoSuchElementException if this is empty. |
int |
get(int i)
If i<0 or i>=getSize(), throws IndexOutOfBoundsException. |
int |
getCapacity()
Returns the number of elements that this can hold, i.e., the max size that was passed to the constructor. |
int |
getSize()
Returns the number of elements in this. |
boolean |
isEmpty()
Returns true if and only if this is empty. |
boolean |
isFull()
Returns true if and only if this is full, e.g., adding another element would force another out. |
org.limewire.collection.IntBuffer.IntBufferIterator |
iterator()
|
int |
last()
Returns the tail of this, or throws NoSuchElementException if this is empty. |
int |
remove(int i)
|
boolean |
removeAll(int x)
|
int |
removeFirst()
|
int |
removeLast()
|
boolean |
removeValue(int x)
|
void |
set(int i,
int value)
|
int |
size()
Same as getSize(). |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IntBuffer(int size)
public IntBuffer(IntBuffer other)
| Method Detail |
|---|
public boolean isEmpty()
public boolean isFull()
public final int size()
public int getSize()
public int getCapacity()
public int get(int i)
throws IndexOutOfBoundsException
IndexOutOfBoundsException
public void set(int i,
int value)
throws IndexOutOfBoundsException
IndexOutOfBoundsExceptionpublic int add(int x)
public int addFirst(int x)
public int addLast(int x)
public boolean contains(int x)
public int first()
throws NoSuchElementException
NoSuchElementException
public int last()
throws NoSuchElementException
NoSuchElementException
public int removeFirst()
throws NoSuchElementException
NoSuchElementException
public int removeLast()
throws NoSuchElementException
NoSuchElementException
public int remove(int i)
throws IndexOutOfBoundsException
IndexOutOfBoundsExceptionpublic boolean removeValue(int x)
public boolean removeAll(int x)
public void clear()
public org.limewire.collection.IntBuffer.IntBufferIterator iterator()
iterator in interface Iterable<Integer>public Object clone()
clone in class Objectpublic String toString()
toString in class Object
|
LimeWire Collection Component API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||