[{"data":1,"prerenderedAt":628},["ShallowReactive",2],{"navigation_docs":3,"trending-repo-TheAlgorithms\u002FJava":249,"page-views-\u002Ftrending\u002FTheAlgorithms\u002FJava":626},[4,29,104,124,194],{"title":5,"icon":6,"path":7,"stem":8,"children":9},"Start",false,"\u002Fstart","1.start",[10,14,19,24],{"title":11,"path":7,"stem":12,"icon":13},"What jscpd finds","1.start\u002Findex","i-lucide-house",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fstart\u002Finstallation","1.start\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quickstart","\u002Fstart\u002Fquickstart","1.start\u002F3.quickstart","i-lucide-rocket",{"title":25,"path":26,"stem":27,"icon":28},"Configuration basics","\u002Fstart\u002Fconfiguration","1.start\u002F4.configuration","i-lucide-settings-2",{"title":30,"icon":6,"path":31,"stem":32,"children":33,"page":6},"Guides","\u002Fguides","2.guides",[34,39,44,49,54,59,64,69,74,79,84,89,94,99],{"title":35,"path":36,"stem":37,"icon":38},"Use jscpd in CI","\u002Fguides\u002Fci","2.guides\u002F01.ci","i-lucide-github",{"title":40,"path":41,"stem":42,"icon":43},"Pre-commit hooks","\u002Fguides\u002Fpre-commit","2.guides\u002F02.pre-commit","i-lucide-git-commit",{"title":45,"path":46,"stem":47,"icon":48},"Fail only on new duplication","\u002Fguides\u002Fbaseline","2.guides\u002F03.baseline","i-lucide-git-compare",{"title":50,"path":51,"stem":52,"icon":53},"Monorepos","\u002Fguides\u002Fmonorepos","2.guides\u002F04.monorepos","i-lucide-folder-tree",{"title":55,"path":56,"stem":57,"icon":58},"Cross-format detection","\u002Fguides\u002Fcross-format","2.guides\u002F05.cross-format","i-lucide-layers",{"title":60,"path":61,"stem":62,"icon":63},"Agents","\u002Fguides\u002Fagents","2.guides\u002F06.agents","i-lucide-cpu",{"title":65,"path":66,"stem":67,"icon":68},"Editors","\u002Fguides\u002Feditors","2.guides\u002F07.editors","i-lucide-code",{"title":70,"path":71,"stem":72,"icon":73},"Duplication over git history","\u002Fguides\u002Fhistory","2.guides\u002F08.history","i-lucide-chart-no-axes-combined",{"title":75,"path":76,"stem":77,"icon":78},"Dashboard and health score","\u002Fguides\u002Fdashboard","2.guides\u002F09.dashboard","i-lucide-layout-dashboard",{"title":80,"path":81,"stem":82,"icon":83},"Dead code","\u002Fguides\u002Fdead-code","2.guides\u002F10.dead-code","i-lucide-ghost",{"title":85,"path":86,"stem":87,"icon":88},"Comparing two codebases","\u002Fguides\u002Fcompare","2.guides\u002F11.compare","i-lucide-git-compare-arrows",{"title":90,"path":91,"stem":92,"icon":93},"Semantic clones","\u002Fguides\u002Fsemantic-clones","2.guides\u002F12.semantic-clones","i-lucide-brain-circuit",{"title":95,"path":96,"stem":97,"icon":98},"Similar functions","\u002Fguides\u002Fsimilarity","2.guides\u002F13.similarity","i-lucide-list-tree",{"title":100,"path":101,"stem":102,"icon":103},"Boundaries","\u002Fguides\u002Fboundaries","2.guides\u002F14.boundaries","i-lucide-fence",{"title":105,"icon":6,"path":106,"stem":107,"children":108,"page":6},"Concepts","\u002Fconcepts","3.concepts",[109,114,119],{"title":110,"path":111,"stem":112,"icon":113},"Types of code clones","\u002Fconcepts\u002Fclone-types","3.concepts\u002F1.clone-types","i-lucide-copy",{"title":115,"path":116,"stem":117,"icon":118},"How detection works","\u002Fconcepts\u002Fhow-detection-works","3.concepts\u002F2.how-detection-works","i-lucide-scan-search",{"title":120,"path":121,"stem":122,"icon":123},"The health score","\u002Fconcepts\u002Fhealth-score","3.concepts\u002F3.health-score","i-lucide-heart-pulse",{"title":125,"icon":6,"path":126,"stem":127,"children":128,"page":6},"Reference","\u002Freference","4.reference",[129,134,139,144,181,186,190],{"title":130,"path":131,"stem":132,"icon":133},"CLI options","\u002Freference\u002Fcli","4.reference\u002F1.cli","i-lucide-terminal",{"title":135,"path":136,"stem":137,"icon":138},"The config file","\u002Freference\u002Fconfig-file","4.reference\u002F2.config-file","i-lucide-settings",{"title":140,"path":141,"stem":142,"icon":143},"Exit codes","\u002Freference\u002Fexit-codes","4.reference\u002F3.exit-codes","i-lucide-log-out",{"title":145,"icon":6,"path":146,"stem":147,"children":148},"Reporters","\u002Freference\u002Freporters","4.reference\u002F4.reporters\u002Findex",[149,151,156,161,166,171,176],{"title":145,"path":146,"stem":147,"icon":150},"i-lucide-file-chart-column",{"title":152,"path":153,"stem":154,"icon":155},"HTML reporter","\u002Freference\u002Freporters\u002Fhtml","4.reference\u002F4.reporters\u002F2.html","i-lucide-file-code",{"title":157,"path":158,"stem":159,"icon":160},"JSON reporter","\u002Freference\u002Freporters\u002Fjson","4.reference\u002F4.reporters\u002F3.json","i-lucide-braces",{"title":162,"path":163,"stem":164,"icon":165},"Badge reporter","\u002Freference\u002Freporters\u002Fbadge","4.reference\u002F4.reporters\u002F4.badge","i-lucide-award",{"title":167,"path":168,"stem":169,"icon":170},"SARIF reporter","\u002Freference\u002Freporters\u002Fsarif","4.reference\u002F4.reporters\u002F5.sarif","i-lucide-shield-check",{"title":172,"path":173,"stem":174,"icon":175},"CodeClimate reporter","\u002Freference\u002Freporters\u002Fcodeclimate","4.reference\u002F4.reporters\u002F6.codeclimate","i-lucide-flag-triangle-right",{"title":177,"path":178,"stem":179,"icon":180},"OpenMetrics reporter","\u002Freference\u002Freporters\u002Fopenmetrics","4.reference\u002F4.reporters\u002F7.openmetrics","i-lucide-activity",{"title":182,"path":183,"stem":184,"icon":185},"Supported formats","\u002Freference\u002Fsupported-formats","4.reference\u002F5.supported-formats","i-lucide-languages",{"title":187,"path":188,"stem":189,"icon":38},"GitHub Action","\u002Freference\u002Fgithub-action","4.reference\u002F6.github-action",{"title":191,"path":192,"stem":193,"icon":68},"Rust crates","\u002Freference\u002Frust-crates","4.reference\u002F7.rust-crates",{"title":195,"icon":6,"path":196,"stem":197,"children":198,"page":6},"Project","\u002Fproject","5.project",[199,204,209,214,239,244],{"title":200,"path":201,"stem":202,"icon":203},"Changelog","\u002Fproject\u002Fchangelog","5.project\u002F1.changelog","i-lucide-scroll-text",{"title":205,"path":206,"stem":207,"icon":208},"Migrating from v4 to v5","\u002Fproject\u002Fmigration","5.project\u002F2.migration","i-lucide-arrow-right-left",{"title":210,"path":211,"stem":212,"icon":213},"jscpd v4 (TypeScript)","\u002Fproject\u002Fv4","5.project\u002F3.v4","i-simple-icons-typescript",{"title":215,"icon":6,"path":216,"stem":217,"children":218},"Benchmarks","\u002Fproject\u002Fbenchmarks","5.project\u002F4.benchmarks\u002Findex",[219,221,226,230,235],{"title":215,"path":216,"stem":217,"icon":220},"i-lucide-gauge",{"title":222,"path":223,"stem":224,"icon":225},"Detection Speed","\u002Fproject\u002Fbenchmarks\u002Fdetection-speed","5.project\u002F4.benchmarks\u002F2.detection-speed","i-lucide-zap",{"title":227,"path":228,"stem":229,"icon":58},"Multi-Format Detection","\u002Fproject\u002Fbenchmarks\u002Fcross-format","5.project\u002F4.benchmarks\u002F3.cross-format",{"title":231,"path":232,"stem":233,"icon":234},"AI Token Efficiency","\u002Fproject\u002Fbenchmarks\u002Fai-token-efficiency","5.project\u002F4.benchmarks\u002F4.ai-token-efficiency","i-lucide-sparkles",{"title":236,"path":237,"stem":238,"icon":93},"Embedding Models","\u002Fproject\u002Fbenchmarks\u002Fembedding-models","5.project\u002F4.benchmarks\u002F5.embedding-models",{"title":240,"path":241,"stem":242,"icon":243},"Research","\u002Fproject\u002Fresearch","5.project\u002F5.research","i-lucide-graduation-cap",{"title":245,"path":246,"stem":247,"icon":248},"Articles","\u002Fproject\u002Farticles","5.project\u002F6.articles","i-lucide-newspaper",{"name":250,"url":251,"appearances":252,"latest":268},"TheAlgorithms\u002FJava","https:\u002F\u002Fgithub.com\u002FTheAlgorithms\u002FJava",[253],{"date":254,"rank":255,"stars":256,"starsToday":257,"headSha":258,"sources":259,"lines":260,"clones":261,"duplicatedLines":262,"percentage":263,"codePercentage":264,"codeSources":265,"healthScore":266,"healthGrade":267},"2026-11-12",8,67107,51,"c46808958406c3b74726542fc9ad7e8038fe924e",1652,154791,1191,11595,7.49,5.48,841,70.2,"B",{"date":254,"generatedAt":269,"name":250,"url":251,"description":270,"language":271,"stars":256,"starsToday":257,"defaultBranch":272,"headSha":258,"durationMs":273,"total":274,"formats":278,"topClones":312,"code":470,"health":544,"complexity":570,"deadCode":623},"2026-11-12T05:21:45.783Z","All Algorithms implemented in Java","Java","master",2185,{"sources":259,"lines":260,"tokens":275,"clones":261,"duplicatedLines":262,"duplicatedTokens":276,"percentage":263,"percentageTokens":277},1962801,129067,6.58,[279,284,289,293,296,300,304,306,309],{"format":280,"sources":281,"lines":282,"clones":261,"duplicatedLines":262,"percentage":283},"java",1617,151197,7.67,{"format":285,"sources":286,"lines":287,"clones":288,"duplicatedLines":288,"percentage":288},"markdown",12,2222,0,{"format":290,"sources":291,"lines":292,"clones":288,"duplicatedLines":288,"percentage":288},"markup",4,565,{"format":294,"sources":286,"lines":295,"clones":288,"duplicatedLines":288,"percentage":288},"yaml",533,{"format":297,"sources":298,"lines":299,"clones":288,"duplicatedLines":288,"percentage":288},"properties",1,111,{"format":301,"sources":302,"lines":303,"clones":288,"duplicatedLines":288,"percentage":288},"docker",2,47,{"format":305,"sources":298,"lines":303,"clones":288,"duplicatedLines":288,"percentage":288},"json",{"format":307,"sources":302,"lines":308,"clones":288,"duplicatedLines":288,"percentage":288},"text",42,{"format":310,"sources":298,"lines":311,"clones":288,"duplicatedLines":288,"percentage":288},"python",27,[313,337,363,382,392,406,416,440,452,461],{"format":280,"lines":314,"tokens":315,"first":316,"others":320,"copies":302,"excerpt":325,"kind":336},87,1552,{"name":317,"start":318,"end":319},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdatastructures\u002Fcaches\u002FFIFOCache.java",242,328,[321],{"name":322,"start":323,"end":324},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdatastructures\u002Fcaches\u002FLIFOCache.java",255,341,{"lines":326,"total":314},[327,328,329,330,331,332,333,334,331,335],"}","","\u002F**"," * Notifies the eviction listener, if one is registered, that a key-value pair has been evicted."," *"," * \u003Cp>If the {@code evictionListener} is not {@code null}, it is invoked with the provided key"," * and value. Any exceptions thrown by the listener are caught and logged to standard error,"," * preventing them from disrupting cache operations."," * @param key   the key that was evicted","code",{"format":280,"lines":338,"tokens":339,"first":340,"others":343,"copies":351,"excerpt":352,"kind":336},19,615,{"name":317,"start":341,"end":342},155,173,[344,347],{"name":322,"start":345,"end":346},161,179,{"name":348,"start":349,"end":350},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdatastructures\u002Fcaches\u002FRRCache.java",154,172,3,{"lines":353,"total":338},[354,355,356,331,357,358,359,360,361,362]," * If the key does not exist and the cache is full, the oldest entry is evicted to make space."," * Expired entries are also cleaned up prior to any eviction. The eviction listener"," * is notified when an entry gets evicted."," * @param key        the key to associate with the cached value; must not be {@code null}"," * @param value      the value to be cached; must not be {@code null}"," * @param ttlMillis  the time-to-live for this entry in milliseconds; must be >= 0"," * @throws IllegalArgumentException if {@code key} or {@code value} is {@code null}, or if {@code ttlMillis} is negative"," *\u002F","public void put(K key, V value, long ttlMillis) {",{"format":280,"lines":364,"tokens":365,"first":366,"others":369,"copies":302,"excerpt":373,"kind":336},46,1101,{"name":317,"start":367,"end":368},481,526,[370],{"name":322,"start":371,"end":372},495,540,{"lines":374,"total":364},[375,329,376,331,377,378,361,379,380,381],"private EvictionStrategy\u003CK, V> evictionStrategy = new FIFOCache.ImmediateEvictionStrategy\u003C>();"," * Creates a new {@code Builder} with the specified cache capacity."," * @param capacity the maximum number of entries the cache can hold; must be > 0"," * @throws IllegalArgumentException if {@code capacity} is less than or equal to 0","public Builder(int capacity) {","    if (capacity \u003C= 0) {","        throw new IllegalArgumentException(\"Capacity must be > 0\");",{"format":280,"lines":383,"tokens":384,"first":385,"others":388,"copies":302,"kind":336},59,999,{"name":317,"start":386,"end":387},241,299,[389],{"name":348,"start":390,"end":391},227,285,{"format":280,"lines":393,"tokens":394,"first":395,"others":398,"copies":351,"kind":336},7,474,{"name":396,"start":397,"end":338},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdynamicprogramming\u002FFibonacci.java",13,[399,402],{"name":400,"start":286,"end":401},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fmaths\u002FFibonacciLoop.java",18,{"name":403,"start":404,"end":405},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Frecursion\u002FFibonacciSeries.java",15,21,{"format":280,"lines":407,"tokens":408,"first":409,"others":412,"copies":351,"kind":336},10,473,{"name":317,"start":410,"end":411},24,33,[413,415],{"name":322,"start":311,"end":414},36,{"name":348,"start":410,"end":411},{"format":280,"lines":417,"tokens":390,"first":418,"others":421,"copies":438,"kind":439},41,{"name":419,"start":314,"end":420},"src\u002Ftest\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fsorts\u002FAdaptiveMergeSortTest.java",127,[422,426,430,434],{"name":423,"start":424,"end":425},"src\u002Ftest\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fsorts\u002FBogoSortTest.java",96,136,{"name":427,"start":428,"end":429},"src\u002Ftest\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fsorts\u002FBubbleSortTest.java",124,164,{"name":431,"start":432,"end":433},"src\u002Ftest\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fsorts\u002FInsertionSortTest.java",144,184,{"name":435,"start":436,"end":437},"src\u002Ftest\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fsorts\u002FSlowSortTest.java",109,149,5,"tests",{"format":280,"lines":338,"tokens":441,"first":442,"others":445,"copies":351,"kind":336},378,{"name":317,"start":443,"end":444},531,549,[446,449],{"name":322,"start":447,"end":448},545,563,{"name":348,"start":450,"end":451},487,505,{"format":280,"lines":453,"tokens":454,"first":455,"others":457,"copies":302,"kind":336},30,749,{"name":317,"start":456,"end":428},95,[458],{"name":348,"start":459,"end":460},94,123,{"format":280,"lines":462,"tokens":463,"first":464,"others":466,"copies":302,"kind":336},26,712,{"name":317,"start":456,"end":465},120,[467],{"name":322,"start":468,"end":469},100,125,{"sources":265,"lines":471,"tokens":472,"clones":473,"duplicatedLines":474,"duplicatedTokens":475,"percentage":264,"percentageTokens":476,"formats":477,"topClones":483,"generated":542},88511,1409938,457,4854,78298,5.55,[478,482],{"format":280,"sources":479,"lines":480,"clones":473,"duplicatedLines":474,"percentage":481},840,88484,5.49,{"format":310,"sources":298,"lines":311,"clones":288,"duplicatedLines":288,"percentage":288},[484,490,497,503,507,512,517,522,526,530],{"format":280,"lines":314,"tokens":315,"first":485,"others":486,"copies":302,"excerpt":488,"kind":336},{"name":317,"start":318,"end":319},[487],{"name":322,"start":323,"end":324},{"lines":489,"total":314},[327,328,329,330,331,332,333,334,331,335],{"format":280,"lines":338,"tokens":339,"first":491,"others":492,"copies":351,"excerpt":495,"kind":336},{"name":317,"start":341,"end":342},[493,494],{"name":322,"start":345,"end":346},{"name":348,"start":349,"end":350},{"lines":496,"total":338},[354,355,356,331,357,358,359,360,361,362],{"format":280,"lines":364,"tokens":365,"first":498,"others":499,"copies":302,"excerpt":501,"kind":336},{"name":317,"start":367,"end":368},[500],{"name":322,"start":371,"end":372},{"lines":502,"total":364},[375,329,376,331,377,378,361,379,380,381],{"format":280,"lines":383,"tokens":384,"first":504,"others":505,"copies":302,"kind":336},{"name":317,"start":386,"end":387},[506],{"name":348,"start":390,"end":391},{"format":280,"lines":393,"tokens":394,"first":508,"others":509,"copies":351,"kind":336},{"name":396,"start":397,"end":338},[510,511],{"name":400,"start":286,"end":401},{"name":403,"start":404,"end":405},{"format":280,"lines":407,"tokens":408,"first":513,"others":514,"copies":351,"kind":336},{"name":317,"start":410,"end":411},[515,516],{"name":322,"start":311,"end":414},{"name":348,"start":410,"end":411},{"format":280,"lines":338,"tokens":441,"first":518,"others":519,"copies":351,"kind":336},{"name":317,"start":443,"end":444},[520,521],{"name":322,"start":447,"end":448},{"name":348,"start":450,"end":451},{"format":280,"lines":453,"tokens":454,"first":523,"others":524,"copies":302,"kind":336},{"name":317,"start":456,"end":428},[525],{"name":348,"start":459,"end":460},{"format":280,"lines":462,"tokens":463,"first":527,"others":528,"copies":302,"kind":336},{"name":317,"start":456,"end":465},[529],{"name":322,"start":468,"end":469},{"format":280,"lines":531,"tokens":532,"first":533,"others":537,"copies":302,"kind":336},50,682,{"name":534,"start":535,"end":536},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fstreaming\u002FCusumDetector.java",167,216,[538],{"name":539,"start":540,"end":541},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fstreaming\u002FEwmaChangeDetector.java",170,219,{"files":288,"minified":288,"sample":543},[],{"score":266,"grade":267,"size":545,"dimensions":549,"skipped":566},{"lines":546,"files":547,"class":548},151271,1620,"L",[550,560],{"id":551,"source":552,"value":553,"adjusted":554,"lines":262,"halfLife":555,"formats":556,"excluded":557,"weight":298,"score":559},"duplication","jscpd",7.7,7.6,8.5,[280,301,310],[290,307,558],"data",53.8,{"id":561,"source":552,"value":562,"adjusted":563,"lines":564,"halfLife":531,"weight":298,"score":565},"complexity",6.1,6.3,9250,91.6,[567],{"id":568,"reason":569},"dead-code","the languages dead code reads are under 5% of the code",{"total":571,"mean":572,"files":573},17609,10.9,[574,579,584,589,594,599,603,608,613,618],{"path":575,"complexity":576,"lines":577,"bytes":578},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fmaths\u002FMathBuilder.java",106,503,14039,{"path":580,"complexity":581,"lines":582,"bytes":583},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fgeometry\u002FBentleyOttmann.java",98,423,15238,{"path":585,"complexity":586,"lines":587,"bytes":588},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fstreaming\u002FUnscentedKalmanFilter.java",85,561,22615,{"path":590,"complexity":591,"lines":592,"bytes":593},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdatastructures\u002Flists\u002FSinglyLinkedList.java",80,476,12791,{"path":595,"complexity":596,"lines":597,"bytes":598},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdatastructures\u002Ftrees\u002FBTree.java",79,323,8930,{"path":600,"complexity":601,"lines":372,"bytes":602},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fstreaming\u002FTDigest.java",75,20064,{"path":604,"complexity":605,"lines":606,"bytes":607},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdatastructures\u002Ftrees\u002FKDTree.java",68,458,13604,{"path":609,"complexity":610,"lines":611,"bytes":612},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fdatastructures\u002Ftrees\u002FRedBlackBST.java",67,339,9590,{"path":614,"complexity":615,"lines":616,"bytes":617},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fconversions\u002FWordsToNumber.java",66,343,12902,{"path":619,"complexity":620,"lines":621,"bytes":622},"src\u002Fmain\u002Fjava\u002Fcom\u002Fthealgorithms\u002Fgraph\u002FHierholzerEulerianPath.java",60,303,9261,{"percentage":288,"findings":288,"files":298,"byCategory":624,"largest":625},[],[],{"\u002Ftrending\u002FTheAlgorithms\u002FJava":627},{"views":288,"visits":288},1794624620417]