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
1
vote
1 answer

How to work with synchronous trove collection?

I'm writing dynamic web project in Java and tried using Trove Collection in one of my servlets. I saw that the problem occurs in the collection create line and after that my project stacks. I've found that the Trove collections are not thread-safe…
0
votes
1 answer

Should I care about no_entry_value in trove4j?

I'm using trove4j for its primitives collections. I notice it has constructors like public TLongArrayList( int capacity, long no_entry_value ) where no_entry_value represents null. The default value is zero. The null value in collections, like Set…
Master Qiao
  • 301
  • 2
  • 10
0
votes
1 answer

How can I use the Trove4j library in my Gradle Project

Hello I was wondering how can I import the Trove4j library to my gradle projcet. Thank you. My build.gradle file plugins { id 'java' id 'application' } sourceCompatibility = 1.11 repositories { mavenCentral() jcenter() } dependencies…
0
votes
0 answers

gnu.trove classes throws java.lang.ArithmeticException: divide by zero

My application uses gnu.trove version 2.0.3. Recently it is throwing divide by zero exceptions in different areas of the gnu.trove library code e.g.: 1. java.lang.ArithmeticException: divide by zero at gnu.trove.TIntHash.index(TIntHash.java:201) at…
0
votes
2 answers

How to use trove for multi hashmap with byte array as key?

currently I'm working with an ArrayListMultiMap of Guave where I handle over 100.000 items. The key of the map is a byte array, the values are long. Now I want to reduce the overhead. My idea is to use only primitive collections and the hashmap of…
501 - not implemented
  • 2,638
  • 4
  • 39
  • 74
0
votes
1 answer

Getting random lines from Trove (TObjectIntHashMap)?

Is there a way to get random lines from a Trove (TObjectIntHashMap)? I'm using Random to test how fast a Trove can seek/load 10,000 lines. Specifically, I'd like to pass in a random integer and have the Trove seek/load that line. I've tried using…
TLe
  • 3
  • 2
0
votes
4 answers

Highest and lowest elements in trove TIntSet?

TIntSet is "sorted set" by sense, i.e. it's elements have natural order. Unfortunately, I can't find any methods similar to first() and last(). Is it possible to overcome this lack somehow?
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
0
votes
1 answer

HashMap equivalent in trove?

I have just learned about trove library and how it's more memory efficient than JDK's Maps. I was previously using a hash map to store totalSize = 2^N double array entries, as follows: final Map myTable = new HashMap(totalSize); I was wondering if…
PyPhys
  • 129
  • 5
  • 10
0
votes
2 answers

TIntObjectHashMap - get Key for given value

How to get the key from Trove TIntObjectHashMap for a value that exists and been found in the map ?? if(map.containsValue(source)) { for (Entry entry : map.entrySet()) { // entrySet() is not recognized by Trove? and i can…
Maciej Cygan
  • 5,351
  • 5
  • 38
  • 72
0
votes
1 answer

Setting default value in Trove hash map

How do I set the default value (returned when the key doesn't exist) for a TLongDoubleHashMap collection. It returns 0 by default, I would like it to return NaN. I found this in the documentation: Returns the value that will be returned from…
Savage Reader
  • 387
  • 1
  • 4
  • 16
0
votes
1 answer

Singleton Collections in Java Trove

Is there anything similar in Trove to Java's Collections.singleton, Collections.singletonList, or singletonMap? I'm working in a application that uses many of the trove collections to reduce memory foot print. However, I have been unable to find any…
Jake Walsh
  • 3,669
  • 5
  • 22
  • 28
0
votes
1 answer

How to set the size of TXXXXArrayList object from trove4j?

How to set the size of TXXXXArrayList object from Trove? For example, is it possible to set the size of TIntArrayList? The only way I found is to add elements (zeros). Even bulk methods, which allowing initialize or add primitive arrays, do…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
0
votes
1 answer

strange OutOfMemory when creating big trove collection

In my app start up, I'm creating trove long hash set with 75*10^6 capacity. Profiler shows, that app use 1.4g for it. I'm try to set -Xmx1600m, and catch out of memory. -Xmx2000m same. -Xmx2030m same. -Xmx2040m OK. Profiler doesn't see so big…
mishka
  • 2,027
  • 2
  • 20
  • 30
0
votes
1 answer

Is there an efficient way to set all values in a Trove map to zero?

Is there an efficient way to set all values in a Trove map to zero? Right now I am doing this: public static class NcZeroD implements TDoubleProcedure{ public TDoubleDoubleHashMap map; @Override public boolean…
user1149913
  • 4,463
  • 1
  • 23
  • 28
-1
votes
2 answers

What are the advantages of TLongArrayList over long[]

I saw that in some places that the data structure TLongArrayList is used instead of an array of long primitives. I wish to ask what is the benefit to use TLongArrayList over long[] ?
CrazySynthax
  • 13,662
  • 34
  • 99
  • 183