Questions tagged [trove4j]

The Trove library provides high speed regular and primitive collections for Java.

The GNU Trove library has two objectives:

  1. Provide "free" (as in "free speech" and "free beer"), fast, lightweight implementations of the java.util Collections API. These implementations are designed to be pluggable replacements for their JDK equivalents.
  2. Provide primitive collections with similar APIs to the above. This gap in the JDK is often addressed by using the "wrapper" classes (java.lang.Integer, java.lang.Float, etc.) with Object-based collections. For most applications, however, collections which store primitives directly will require less space and yield significant performance gains.

Trove allows both server-side and client applications to work faster and use less memory.

47 questions
15
votes
9 answers

Why not allow an external interface to provide hashCode/equals for a HashMap?

With a TreeMap it's trivial to provide a custom Comparator, thus overriding the semantics provided by Comparable objects added to the map. HashMaps however cannot be controlled in this manner; the functions providing hash values and equality checks…
volley
  • 6,651
  • 1
  • 27
  • 28
14
votes
1 answer

Primitive alternative to Guava Table

Is there an alternative to Guava Tables that uses primitives, instead of generic types, as the keys? I would like to use primitives to avoid the auto-boxing caused by using Java Numbers and the additional entry objects created by Java Maps. I've…
Jake Walsh
  • 3,669
  • 5
  • 22
  • 28
13
votes
2 answers

Is the Trove library thread-safe?

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?
Ravi
  • 1,082
  • 4
  • 15
  • 24
9
votes
2 answers

JVM Crash with G1 GC and trove library

We have the following problem: On some of our Linux machine, Java applications which make use of the trove library and G1 GC will crash rather fast with messages of the following type: A fatal error has been detected by the Java Runtime…
malamut
  • 456
  • 4
  • 12
7
votes
1 answer

LinkedHashMap memory consumption

The user uploads a huge file consisting of 1 million words. I parse the file and put the each line of the file into a LinkedHashMap. I need O(1) access and removal by key. Also, I need to preserve the access order, iterate from any…
user12384512
  • 3,362
  • 10
  • 61
  • 97
7
votes
2 answers

Trove Library Queue implementation

I am using trove 3.0.3 library in java project. All classes in gnu.trove.queue (TByteQueue, TDoubleQueue ...) are all interfaces. Where I can find implementation of Queue classes?
cdkrot
  • 279
  • 1
  • 2
  • 8
6
votes
5 answers

Which NoSQL Implementation is Most Appropriate?

I'm new to NoSQL, and I'm scratching my head trying to figure out the most appropriate NoSQL implementation for the application I'm trying to build. My Java application needs to have an in-memory hashmap containing millions to billions of entries as…
herrtim
  • 2,697
  • 1
  • 26
  • 36
5
votes
6 answers

What is the name of this locking technique?

I've got a gigantic Trove map and a method that I need to call very often from multiple threads. Most of the time this method shall return true. The threads are doing heavy number crunching and I noticed that there was some contention due to the…
Cedric Martin
  • 5,945
  • 4
  • 34
  • 66
4
votes
4 answers

Java Multimap with Trove

I have a pretty large google Multimap and was looking into ways to reduce the memory usage. In all of the examples I can find people are doing something like: Multimaps.newSetMultimap( TDecorators.wrap(new…
chrstahl89
  • 580
  • 10
  • 21
3
votes
1 answer

Using standard Java HashMap (compared to Trove THashMap) causes non-HashMap code to run slower

I use a HashMap to cache about 2 million values calculated through a recursive algorithm. I use either HashMap from the Collections Framework, or the TIntDoubleHashMap from the Trove library, controlled by the boolean useTrove…
J3D1
  • 759
  • 6
  • 10
3
votes
1 answer

Integer set with continuous regions in Java

I would like to have int tree set implementation, which is optimized for sets with a lot of continuous regions. For example, such tree could know that is contains entire region from 100 to 150 and hence searching for 120 ends once this region…
Dims
  • 47,675
  • 117
  • 331
  • 600
3
votes
2 answers

How to return an unmodifiable view of a Java Trove collection?

I'd like to put unmodifiable wrappers around some of the Trove collections: I've checked the Trove documentation and I cannot seem to find an easy way to do it (I may have overlooked something obvious). So as of now every time I need such an…
SyntaxT3rr0r
  • 27,745
  • 21
  • 87
  • 120
3
votes
1 answer

Trove4j TObjectIntHashMap vs EnumMap

Usually people say we should use EnumMap when the key is an enum. But what about this case I want to count the frequencies of each enum value, it seems like trove4j TObjectIntHashMap is better in code. The following is the example with trove4j…
Xiansong
  • 91
  • 2
  • 8
3
votes
5 answers

Collection to store primitive ints that allows for faster contains() & ordered iteration

I need a space efficient collection to store a large list of primitive int(s)(with around 800,000 ints), that allows for fast operations for contains() & allows for iteration in a defined order. Faster contains() operations to check whether an int…
Rajat Gupta
  • 25,853
  • 63
  • 179
  • 294
3
votes
1 answer

Java Hash Multi Map (key with multiple values) Implementation

From here, I found that Colt's OpenIntIntHashMap and Trove's TIntIntHashMap give better performance and memory uses than Java's built in HashMap or Guava's HashMultimap. Do Colt's OpenIntIntHashMap or Trove's TIntIntHashMap allow keys with multiple…
Arpssss
  • 3,850
  • 6
  • 36
  • 80
1
2 3 4