{"id":15036705,"url":"https://github.com/java-diff-utils/java-diff-utils","last_synced_at":"2025-05-12T13:15:05.353Z","repository":{"id":37735641,"uuid":"86663812","full_name":"java-diff-utils/java-diff-utils","owner":"java-diff-utils","description":"Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.","archived":false,"fork":false,"pushed_at":"2025-05-04T22:53:23.000Z","size":3006,"stargazers_count":1355,"open_issues_count":2,"forks_count":193,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-05-12T13:14:50.365Z","etag":null,"topics":["computing-diffs","diff","diff-algorithm","inline","java","java-diff-utils","merge-text","meyer","tools","unified-diffs"],"latest_commit_sha":null,"homepage":"https://java-diff-utils.github.io/java-diff-utils/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/java-diff-utils.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://paypal.me/wumpz"}},"created_at":"2017-03-30T05:47:23.000Z","updated_at":"2025-05-10T09:19:34.000Z","dependencies_parsed_at":"2024-01-03T01:27:39.068Z","dependency_job_id":"9cf9c552-ede7-4925-bee8-b42c6c41db0d","html_url":"https://github.com/java-diff-utils/java-diff-utils","commit_stats":{"total_commits":450,"total_committers":33,"mean_commits":"13.636363636363637","dds":"0.18222222222222217","last_synced_commit":"aff6bfed2953298d031c0b2a5601c6b3da72bfb0"},"previous_names":["wumpz/java-diff-utils"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-diff-utils%2Fjava-diff-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-diff-utils%2Fjava-diff-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-diff-utils%2Fjava-diff-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-diff-utils%2Fjava-diff-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/java-diff-utils","download_url":"https://codeload.github.com/java-diff-utils/java-diff-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745196,"owners_count":21957319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computing-diffs","diff","diff-algorithm","inline","java","java-diff-utils","merge-text","meyer","tools","unified-diffs"],"created_at":"2024-09-24T20:32:04.853Z","updated_at":"2025-05-12T13:15:04.342Z","avatar_url":"https://github.com/java-diff-utils.png","language":"Java","readme":"# java-diff-utils\n\n## Status\n\n[![Build Status](https://travis-ci.org/java-diff-utils/java-diff-utils.svg?branch=master)](https://travis-ci.org/java-diff-utils/java-diff-utils)\n\n[![Build Status using Github Actions](https://github.com/java-diff-utils/java-diff-utils/workflows/Java%20CI%20with%20Maven/badge.svg)](https://github.com/java-diff-utils/java-diff-utils/actions?query=workflow%3A%22Java+CI+with+Maven%22)\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/002c53aa0c924f71ac80a2f65446dfdd)](https://www.codacy.com/gh/java-diff-utils/java-diff-utils/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=java-diff-utils/java-diff-utils\u0026amp;utm_campaign=Badge_Grade)\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.java-diff-utils/java-diff-utils/badge.svg)](http://maven-badges.herokuapp.com/maven-central/io.github.java-diff-utils/java-diff-utils)\n\n## Intro\n\nDiff Utils library is an OpenSource library for performing the comparison operations between texts: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.\n\nMain reason to build this library was the lack of easy-to-use libraries with all the usual stuff you need while working with diff files. Originally it was inspired by JRCS library and it's nice design of diff module.\n\n**This is originally a fork of java-diff-utils from Google Code Archive.**\n\n## API\n\nJavadocs of the actual release version: [JavaDocs java-diff-utils](https://java-diff-utils.github.io/java-diff-utils/4.10/docs/apidocs/)\n\n## Examples\n\nLook [here](https://github.com/java-diff-utils/java-diff-utils/wiki) to find more helpful informations and examples.\n\nThese two outputs are generated using this java-diff-utils. The source code can also be found at the *Examples* page:\n\n**Producing a one liner including all difference information.**\n\n```Java\n//create a configured DiffRowGenerator\nDiffRowGenerator generator = DiffRowGenerator.create()\n                .showInlineDiffs(true)\n                .mergeOriginalRevised(true)\n                .inlineDiffByWord(true)\n                .oldTag(f -\u003e \"~\")      //introduce markdown style for strikethrough\n                .newTag(f -\u003e \"**\")     //introduce markdown style for bold\n                .build();\n\n//compute the differences for two test texts.\nList\u003cDiffRow\u003e rows = generator.generateDiffRows(\n                Arrays.asList(\"This is a test senctence.\"),\n                Arrays.asList(\"This is a test for diffutils.\"));\n        \nSystem.out.println(rows.get(0).getOldLine());\n```\n\nThis is a test ~senctence~**for diffutils**.\n\n**Producing a side by side view of computed differences.**\n\n```Java\nDiffRowGenerator generator = DiffRowGenerator.create()\n                .showInlineDiffs(true)\n                .inlineDiffByWord(true)\n                .oldTag(f -\u003e \"~\")\n                .newTag(f -\u003e \"**\")\n                .build();\nList\u003cDiffRow\u003e rows = generator.generateDiffRows(\n                Arrays.asList(\"This is a test senctence.\", \"This is the second line.\", \"And here is the finish.\"),\n                Arrays.asList(\"This is a test for diffutils.\", \"This is the second line.\"));\n        \nSystem.out.println(\"|original|new|\");\nSystem.out.println(\"|--------|---|\");\nfor (DiffRow row : rows) {\n    System.out.println(\"|\" + row.getOldLine() + \"|\" + row.getNewLine() + \"|\");\n}\n```\n\n|original|new|\n|--------|---|\n|This is a test ~senctence~.|This is a test **for diffutils**.|\n|This is the second line.|This is the second line.|\n|~And here is the finish.~||\n\n## Main Features\n\n* computing the difference between two texts.\n* capable to hand more than plain ascii. Arrays or List of any type that implements hashCode() and equals() correctly can be subject to differencing using this library\n* patch and unpatch the text with the given patch\n* parsing the unified diff format\n* producing human-readable differences\n* inline difference construction\n* Algorithms:\n  * Myers Standard Algorithm\n  * Myers with linear space improvement\n  * HistogramDiff using JGit Library\n\n### Algorithms\n\n* Myer's diff\n* HistogramDiff\n\nBut it can easily replaced by any other which is better for handing your texts. I have plan to add implementation of some in future.\n\n## Source Code conventions\n\nRecently a checkstyle process was integrated into the build process. java-diff-utils follows the sun java format convention. There are no TABs allowed. Use spaces.\n\n```java\npublic static \u003cT\u003e Patch\u003cT\u003e diff(List\u003cT\u003e original, List\u003cT\u003e revised,\n    BiPredicate\u003cT, T\u003e equalizer) throws DiffException {\n    if (equalizer != null) {\n        return DiffUtils.diff(original, revised,\n        new MyersDiff\u003c\u003e(equalizer));\n    }\n    return DiffUtils.diff(original, revised, new MyersDiff\u003c\u003e());\n}\n```\n\nThis is a valid piece of source code:\n\n* blocks without braces are not allowed\n* after control statements (if, while, for) a whitespace is expected\n* the opening brace should be in the same line as the control statement\n\n### To Install\n\nJust add the code below to your maven dependencies:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.java-diff-utils\u003c/groupId\u003e\n    \u003cartifactId\u003ejava-diff-utils\u003c/artifactId\u003e\n    \u003cversion\u003e4.15\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nor using gradle:\n\n```groovy\n// https://mvnrepository.com/artifact/io.github.java-diff-utils/java-diff-utils\nimplementation \"io.github.java-diff-utils:java-diff-utils:4.12\"\n```\n","funding_links":["https://paypal.me/wumpz"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjava-diff-utils%2Fjava-diff-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjava-diff-utils%2Fjava-diff-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjava-diff-utils%2Fjava-diff-utils/lists"}