public class Window<E> extends Object
The indices accepted by this container are within a bounded range. This range may start at any
positive integer value, i.e. the container may not allow access to element at index 0
, but
only indices 102-134
for instance. The range will advance automatically as the window gets full
and more elements are added.
Constructor and Description |
---|
Window(int initialIndex,
int capacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element)
Add an element, removing the first element if it's necessary in order to respect the size limit.
|
int |
capacity() |
void |
clear() |
E |
get(int externalIndex) |
boolean |
isEmpty() |
int |
size() |
int |
start() |
public Window(int initialIndex, int capacity)
initialIndex
- The index of the first added element.capacity
- The number of elements that can be added before the first element gets automatically erased.public int start()
public int size()
public boolean isEmpty()
public int capacity()
public E get(int externalIndex)
public boolean add(E element)
element
- The element to add.true
to indicate the element has been added.public void clear()
Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved