diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-30 16:40:07 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-30 16:40:07 +0100 |
commit | 52f1817d84212584f898b94aeb407a65ed4dba9b (patch) | |
tree | d970b47942caf740ba19f5b337ac3543c7aca18d /same/src | |
parent | 6f1f08a15895ca3d56a83dca998a0b692f3d466a (diff) |
Add WorkList data structure.
This class is used to hold commands for a worker thread.
Diffstat (limited to 'same/src')
-rw-r--r-- | same/src/main/java/com/orbekk/util/WorkList.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/same/src/main/java/com/orbekk/util/WorkList.java b/same/src/main/java/com/orbekk/util/WorkList.java new file mode 100644 index 0000000..a4e38d6 --- /dev/null +++ b/same/src/main/java/com/orbekk/util/WorkList.java @@ -0,0 +1,21 @@ +package com.orbekk.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class WorkList<E> extends ArrayList<E> { + public WorkList() { + super(); + } + + public WorkList(Collection<? extends E> collection) { + super(collection); + } + + public synchronized List<E> copyAndClear() { + List<E> copy = new WorkList<E>(this); + clear(); + return copy; + } +} |