Giter Club home page Giter Club logo

Comments (6)

c-rack avatar c-rack commented on July 22, 2024 1

@cavenaghi9 @beclever @illumi I have pushed an update that keeps the order of map entries if the non-canonical mode is active (see README). Publishing to maven central follows.

from cbor-java.

c-rack avatar c-rack commented on July 22, 2024

Map internally uses a HashMap. If you come up with a PR that changes the current HashMap implementation to a TreeMap one, I will merge it.

from cbor-java.

beclever avatar beclever commented on July 22, 2024

I found that it was not the https://github.com/c-rack/cbor-java/blob/master/src/main/java/co/nstant/in/cbor/model/Map.java but the sortedMap of TreeMap
type in https://github.com/c-rack/cbor-java/blob/master/src/main/java/co/nstant/in/cbor/encoder/MapEncoder.java caused the problem. In the case, -2 encode as 33, 0 encode as 0, so key 0 will on first item. I don't know why it should bee sortedMap here?

from cbor-java.

c-rack avatar c-rack commented on July 22, 2024

The TreeMap is used because the CBOR specification has a section about a canonical format:
https://tools.ietf.org/html/rfc7049#section-3.9

One could consider to introduce a non-canoncial mode, which does not use a TreeMap. Any PRs in that direction are welcome.

from cbor-java.

illumi avatar illumi commented on July 22, 2024

I'm also interested in map insertion order. How would you prefer to configure such a mode?

from cbor-java.

vcamargo avatar vcamargo commented on July 22, 2024

@c-rack when the version 0.9 of the library will be available on maven central repository?

from cbor-java.

Related Issues (20)

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.