Giter Club home page Giter Club logo

compactmap's People

Contributors

vlsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

compactmap's Issues

Possible bug for large read/write operations ?

Hi and thank you for making this data structure.

I am writing a java server and have some memory issues. So I wanted to use compactHashMaps. I tested the code with both compactHashMap and normal java HashMap and it seems like the compactHashmap makes my code get an out of memory exception before the original HashMap.

I am running on a ubuntu machine and my java version is java 8. The code is fairly simple and I simply change the type of the data from hashMap for compacyHashMap (mostly just in the declarations) since the methods seem to be similar. I can provide the code if further information was required.

Thank you

size should account removed keys

    @Test
    public void removeShouldBeReflectedInSize() {
        CompactHashMap<String, Object> map = new CompactHashMap<String, Object>();
        map.put("charset", "UTF-8");
        map.remove("charset");
        Assert.assertEquals(map.size(), 0);
        Assert.assertFalse(map.containsKey("charset"));
    }

Default values should be serialized as map

Currently default values are serialzed as a regular key-value pairs.
Thus map provide no improvement on the serialized footprint.

Default values should be serialized as separate map, so it would be shared between different compact maps.

null key

Hi, is there anything preventing from support of null keys?
I understand that underneath dexx collection is used.
But is that the limitation or compactmap itself?

Exception in thread "main" java.lang.NullPointerException
	at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.elemHashCode(CompactHashMap.java:78)
	at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.computeHash(CompactHashMap.java:89)
	at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.get(CompactHashMap.java:65)
	at com.github.andrewoma.dexx.collection.HashMap.get(HashMap.java:102)
	at vlsi.utils.CompactHashMapClass.put(CompactHashMapClass.java:76)
	at vlsi.utils.CompactHashMap.put(CompactHashMap.java:105)

PS. we see huge memory savings with help of this library

containKey returns true on non existing key

    @Test
    public void containsKeyOnNonExistingKey() {
        CompactHashMapDefaultValues.add("k1", "v1");
        CompactHashMap<String, Object> map = new CompactHashMap<String, Object>();
        Assert.assertFalse(map.containsKey("abcd"));
        Assert.assertFalse(map.containsKey("k1"));
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.