Is the Trove library thread-safe?

4.3k views Asked by At

Is the GNU trove library thread-safe? I am particularly interested in TObjectDoubleHashMap. I looked at their documentation, but it hasn't mentioned anything, so shall we assume it is not thread-safe?

2

There are 2 answers

0
Peter Lawrey On BEST ANSWER

Its not thread safe. You can use synchronized or your own Lock to make it thread safe.

1
J. Dimeo On

It has utilities to make it thread safe. See: http://trove4j.sourceforge.net/javadocs/gnu/trove/TCollections.html

Also, since the collections are mostly backed by primitive arrays, you can (usually) safely perform read operations (iteration/get) across multiple threads.