summaryrefslogtreecommitdiff
path: root/same
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-31 09:47:07 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-31 09:47:07 +0100
commit00f5afe8de3544bf99f4d84c7904ed784f50074c (patch)
tree87ca0537ebe012966e70f0a6da9353a9d5e9ffc6 /same
parent52f1817d84212584f898b94aeb407a65ed4dba9b (diff)
Add WorkQueue.
Diffstat (limited to 'same')
-rw-r--r--same/src/main/java/com/orbekk/util/WorkQueue.java138
1 files changed, 138 insertions, 0 deletions
diff --git a/same/src/main/java/com/orbekk/util/WorkQueue.java b/same/src/main/java/com/orbekk/util/WorkQueue.java
new file mode 100644
index 0000000..252beaf
--- /dev/null
+++ b/same/src/main/java/com/orbekk/util/WorkQueue.java
@@ -0,0 +1,138 @@
+package com.orbekk.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * A WorkList is a list for pending units of work.
+ */
+public class WorkQueue<E> implements List<E> {
+ List<E> list = null;
+
+ public WorkQueue() {
+ list = new ArrayList<E>();
+ }
+
+ public WorkQueue(Collection<? extends E> collection) {
+ list = new ArrayList<E>(collection);
+ }
+
+ @Override
+ public boolean add(E e) {
+ return list.add(e);
+ }
+
+ @Override
+ public void add(int index, E element) {
+ list.add(index, element);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> c) {
+ return list.addAll(c);
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends E> c) {
+ return list.addAll(index, c);
+ }
+
+ @Override
+ public void clear() {
+ list.clear();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return list.contains(o);
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return containsAll(c);
+ }
+
+ @Override
+ public E get(int index) {
+ return list.get(index);
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return list.indexOf(o);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return list.isEmpty();
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return list.iterator();
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return list.lastIndexOf(o);
+ }
+
+ @Override
+ public ListIterator<E> listIterator() {
+ return list.listIterator();
+ }
+
+ @Override
+ public ListIterator<E> listIterator(int index) {
+ return list.listIterator(index);
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return list.remove(o);
+ }
+
+ @Override
+ public E remove(int index) {
+ return list.remove(index);
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return list.removeAll(c);
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return list.retainAll(c);
+ }
+
+ @Override
+ public E set(int index, E element) {
+ return list.set(index, element);
+ }
+
+ @Override
+ public int size() {
+ return list.size();
+ }
+
+ @Override
+ public List<E> subList(int fromIndex, int toIndex) {
+ return list.subList(fromIndex, toIndex);
+ }
+
+ @Override
+ public Object[] toArray() {
+ return list.toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return list.toArray(a);
+ }
+
+}