Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
joram
joram
Commits
46ab6fdd
Commit
46ab6fdd
authored
Jun 06, 2014
by
afreyssin
Browse files
Adds a search synchronized method allowing to find an element in the queue.
parent
de515371
Changes
1
Show whitespace changes
Inline
Side-by-side
joram/a3/common/src/main/java/fr/dyade/aaa/common/Queue.java
View file @
46ab6fdd
...
...
@@ -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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment