13

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?

sebkur
  • 658
  • 2
  • 9
  • 18
Ravi
  • 1,082
  • 4
  • 15
  • 24

2 Answers2

12

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.

J. Dimeo
  • 829
  • 8
  • 10
9

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

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130