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
2
votes
4 answers

Need an efficient Map or Set that does NOT produce any garbage when adding and removing

So because Javolution does not work (see here) I am in deep need of a Java Map implementation that is efficient and produces no garbage under simple usage. java.util.Map will produce garbage as you add and remove keys. I checked Trove and Guava but…
JohnPristine
  • 3,485
  • 5
  • 30
  • 49
2
votes
3 answers

Could not find artifact gnu.trove:trove:jar:3.0.3 in central (https://repo.maven.apache.org/maven2)

I'm trying to download gnu.trove library, I have this dependency: gnu.trove trove
CyberWolf
  • 81
  • 1
  • 7
2
votes
2 answers

Why the list must be declare by final

TIntArrayList list = new TIntArrayList(); final TIntArrayList tempList = new TIntArrayList(); list.add(10086); list.add(12345); list.add(1989); list.forEach(new TIntProcedure() { @Override public boolean execute(int i) { if (i >…
Frank Yeung
  • 315
  • 1
  • 3
  • 11
2
votes
2 answers

What is the recommended way to iterate a GNU Trove TObjectIntHashMap by decreasing value?

GNU Trove / trove4j TObjectIntHashMap is great for counting String occurences: TObjectIntHashMap map = new TObjectIntHashMap<>(); map.adjustOrPutValue(string, 1, 1); Now a common task is to ask for the string with the highest count or…
dreamflasher
  • 1,387
  • 15
  • 22
2
votes
0 answers

Simultaneous dependencies for Trove 2 and Trove 3 in Maven

According to Trove 3 release notes To aid with migration, every class has moved to a different package, which allows early versions of Trove to co-exist with Trove 3.x. So, you don't have to change everything at once. However, is it actually…
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
2
votes
2 answers

Trove jar THashMap class not found exception

I want to use Trove-1.0.2 jar for maps in my java project. I use eclipse IDE. I have added Trove jar using "Add external jars" in Build path, but still I get ClassNotFoundException. But the class gnu.trove.THashMap is present in the library, when I…
2
votes
2 answers

Is there any ordered Map in gnu trove library?

I am using a LinkedHashMap in my program. But I need one with primitive data types. In trove we have map but it is not ordered? Any idea about ordered one?
Osman Khalid
  • 778
  • 1
  • 7
  • 22
2
votes
1 answer

Any way to define iteration order for trove's TIntHashSet or TIntIntHashMap?

Can I somehow define the iteration order of the elements from Trove's TIntHashSet ? Or are any other primitive Set that allows for defining the order of iteration of elements. I want to iterate the elements in the insertion order or just same…
Rajat Gupta
  • 25,853
  • 63
  • 179
  • 294
1
vote
1 answer

Trove hash maps not implementing hashCode

I stumbled across the issue with TObjectDoubleHashMap of trove. The version 2.0.2 doesn't override the hashCode method. More recent versions of trove (3.0.0) include the hashCode. Note, that the equals method is overriden in both versions. Why…
Leonid
  • 22,360
  • 25
  • 67
  • 91
1
vote
2 answers

Custom implementation of a HashTable in Java?

I was solving the Quora problem and for my particular solution I needed a hashtable (long-keys, int-values) for caching values. I hoped that the Java HashMap could be improved because I knew my data types for the keys and values and they were…
pathikrit
  • 32,469
  • 37
  • 142
  • 221
1
vote
2 answers

Does Java Trove4J library (or another) have boolean primitive collections?

Google is failing me here... I thought this would be a very simple Q&A, but I cannot find any previous discussion of the matter. Is there a reason why the Java Trove4J library does not include boolean primitive collections? Example: TByteHashSet…
kevinarpe
  • 20,319
  • 26
  • 127
  • 154
1
vote
1 answer

TObjectIntMap.get() returns 0 if null Trove

I am using trove library to create hash maps http://trove.starlight-systems.com/ The class I am using is TObjectIntMap in which I had to use the function get. The issue is that get returns 0 if two cases 1- If the value of the specified key is…
Abdelrahman Shoman
  • 2,882
  • 7
  • 36
  • 61
1
vote
2 answers

Hot to port entrySet() method from HashMap to trove4j?

I was often iterating over hashmaps by entrySet() method, expecting this is faster. Now I would like to port some of my code to trove's TIntObjectHashMap, but don't see the method to enumerate entries. Why? How to port?
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
1
vote
1 answer

TObjectIntMap (Trove 3) How can 'int get(java.lang.Object key)' method return null? Is it a documentation mistake?

I have been looking into the documentation of Trove4j library. Particularly the TObjectIntMap interface. According to the documentation of the library the get method returns null if the key is not present in the map. The documentation I am referring…
chr0mzie
  • 181
  • 1
  • 1
  • 9
1
vote
2 answers

how to use gnu trove in eclipse

I downloaded the gnu trove 3.03 and extract it to a local directory. then I add the trove-3.03-src.jar to my project in eclipse, but there is still import error like The import gnu.trove.TDoubleArrayList cannot be resolved,how can I solve this…
ningyuwhut
  • 609
  • 12
  • 27