Giter Club home page Giter Club logo

Comments (5)

gsantner avatar gsantner commented on August 25, 2024

do they have the same filepath by chance, for some reason? I couldn't reproduce this problem yet.

from markor.

guanglinn avatar guanglinn commented on August 25, 2024

Create files Aa.md and BB.md in any folder, then long press Aa.md or BB.md.

These two files have the same hash value.

Screenshot_20240406_061223_net.gsantner.markor_test_edit_485102985336914.jpg

from markor.

guanglinn avatar guanglinn commented on August 25, 2024

References:

  1. Two unequal objects with same hash code - Stack Overflow

  2. Can Java's hashCode() produce same value for different strings? - Stack Overflow

  3. Why can hashCode() return the same value for different objects in Java? - Stack Overflow

from markor.

gsantner avatar gsantner commented on August 25, 2024

Quick idea without too much complex thinking: To just sum orignal hashcode value and the modification unix time (numeric).

At the end, collision still can happen...but that should make it at least way less common. It adds a certain user-controllable part to the quotation too.

from markor.

harshad1 avatar harshad1 commented on August 25, 2024

Very interesting.

I propose this:

    @Override
    public long getItemId(final int position) {
        final File f = _adapterDataFiltered.get(position);
        final Long key = _fileIdMap.get(f);
        if (key == null) {
            final long newId = _lastAssignedId++;
            _fileIdMap.put(f, newId);
            return newId;
        } else {
            return key;
        }
    }

Its kinda brute force, but no collisions

from markor.

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.