Commit 46ab6fdd authored by afreyssin's avatar afreyssin
Browse files

Adds a search synchronized method allowing to find an element in the queue.

parent de515371
......@@ -21,6 +21,7 @@
package fr.dyade.aaa.common;
import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
import java.util.Vector;
......@@ -46,6 +47,13 @@ public class Queue implements Serializable {
*/
private List<Object> elements = new Vector<Object>();
public synchronized boolean search(Comparator<Object> c, Object o2) {
for (Object o1 : elements) {
if (c.compare(o1, o2) == 0) return true;
}
return false;
}
/**
* <code>true</code> if a producer called the <code>stop()</code>
* method.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment