|
|
 |
Article:
 |
 |
The Ox Documentation Tool
|
| Subject: |
Vectors, arg! |
| Date: |
2004-02-04 13:58:06 |
| From: |
S Martin |
|
|
|
|
Why are you using synchronized code in a non-synchronized block, yuck! |
- Vectors, arg!
2004-02-05 09:07:32 Mike Fitzgerald
[Reply]
What do you suggest instead of Vector?
- Vectors, arg!
2004-02-24 14:22:39 Mike Fitzgerald
[Reply]
Following is some feedback I got from Dave Kearns of Mentor Graphics on using Vector:
"The sl.addElement(jf.getInputStream(je)) call is a synchronized call, but the code block around it is not, so potentially, another thread could invoke that method. Maybe it should be synchronized so it would be re-entrant, or safe from unexpected call from a second thread. However, there are not any static variables in the function, and it doesn't look like a function that is going to get called repeatedly. My guess is that it would get called one time. So - so what that you're using a vector? ... A vector is a convenient data structure to use. If you look at the underlying implementation, it's as solid as a linked list (since that's what it ACTUALLY is), but saves you the hassle of having to grow the thing yourself to add new items. I think some people think of Vectors as being a structure that only a BASIC or COBOL coder would use. I've used them many, many times in Java, saved myself lots of time by doing so, and never had a problem."
|
 |
Sponsored By:
|