{"id":30193257,"url":"https://github.com/asarkar/jdata","last_synced_at":"2025-08-13T01:54:40.332Z","repository":{"id":290070678,"uuid":"972777967","full_name":"asarkar/jdata","owner":"asarkar","description":"Java data structures and JUnit 5 utilities used in coding questions","archived":false,"fork":false,"pushed_at":"2025-05-15T01:23:44.000Z","size":93,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-08T22:58:30.339Z","etag":null,"topics":["binary-tree","data-structures","fenwick-tree","java","junit5","leetcode","linked-list"],"latest_commit_sha":null,"homepage":"","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/asarkar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null},"funding":{"github":"asarkar"}},"created_at":"2025-04-25T16:39:29.000Z","updated_at":"2025-05-14T23:52:07.000Z","dependencies_parsed_at":"2025-04-26T17:41:46.897Z","dependency_job_id":"8d0c8cc6-6616-4406-9988-015be7e6805c","html_url":"https://github.com/asarkar/jdata","commit_stats":null,"previous_names":["asarkar/jdata"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/asarkar/jdata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2Fjdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2Fjdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2Fjdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2Fjdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asarkar","download_url":"https://codeload.github.com/asarkar/jdata/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2Fjdata/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270166098,"owners_count":24538444,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["binary-tree","data-structures","fenwick-tree","java","junit5","leetcode","linked-list"],"created_at":"2025-08-13T01:54:36.379Z","updated_at":"2025-08-13T01:54:40.292Z","avatar_url":"https://github.com/asarkar.png","language":"Java","funding_links":["https://github.com/sponsors/asarkar"],"categories":[],"sub_categories":[],"readme":"# Java Data Structures\nJava package containing simple data structures and JUnit 5 utilities used in coding questions \nfound on online platform such as LeetCode. This package can be used while working on such\nquestions locally.\n\nMeant to be used in personal projects only, and makes absolutely no guarantees.\n\n[![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-black?style=for-the-badge\u0026logo=github\u0026color=%23fe8e86)](https://github.com/sponsors/asarkar)\n[![CI](\u003chttps://img.shields.io/github/actions/workflow/status/asarkar/jdata/ci.yml?branch=main\u0026style=for-the-badge\u0026logo=github\u003e)](https://github.com/asarkar/grpc-test/actions?query=workflow%3A%22CI%22)\n[![JitPack](https://img.shields.io/jitpack/version/com.asarkar/jdata?style=for-the-badge\u0026logo=jitpack\u0026color=blue)](https://jitpack.io/#com.asarkar/jdata)\n[![License](https://img.shields.io/github/license/asarkar/jdata?style=for-the-badge\u0026logo=apache\u0026color=brightgreen)](https://www.apache.org/licenses/LICENSE-2.0)\n[![JVM](https://img.shields.io/badge/dynamic/regex?style=for-the-badge\u0026logo=openjdk\u0026color=blue\u0026label=JVM\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fasarkar%2Fjdata%2Frefs%2Fheads%2Fmain%2F.java-version\u0026search=%5Cd%2B)](https://github.com/asarkar/jdata/blob/main/.java-version)\n\n## Development\n\n1. Add the JitPack repository to your Maven or Gradle build:\n   https://jitpack.io\n\n2. Dependency group id = `com.asarkar.jdata`. There are two artifacts under this group,\n   `jdata` and `junit`, choose one or both according to your need.\n\n3. For development version, use a [commit hash](https://github.com/asarkar/jdata/commits/).\n   For release version, use [tag](https://github.com/asarkar/jdata/tags).\n\n## Usage\n\n### jdata\n\n* [ListNode](jdata/src/main/java/com/asarkar/data/ListNode.java)\n\n```\nList\u003cInteger\u003e nums = List.of(1, 2, 3);\nListNode\u003cInteger\u003e head = ListNode.fromIterable(nums);\nif (nums.isEmpty()) {\n    assertThat(head).isNull();\n} else {\n    assertThat(head).isNotNull();\n    List\u003cInteger\u003e actual = ListNode.toList(head);\n    assertThat(actual).isEqualTo(nums);\n}\n```\n* [TreeNode](jdata/src/main/java/com/asarkar/data/TreeNode.java)\n\n```\nList\u003cInteger\u003e nums = List.of(1, 2, 3);\nTreeNode\u003cInteger\u003e root = TreeNode.fromList(nums);\nif (nums.isEmpty()) {\n    assertThat(root).isNull();\n} else {\n    assertThat(root).isNotNull();\n    List\u003cInteger\u003e actual = TreeNode.levelOrder(root);\n    assertThat(actual).isEqualTo(nums);\n}\n\nTreeNode.prettyPrint(root);\n  1\n / \\\n2   3\n```\n\n* [FenwickTree](jdata/src/main/java/com/asarkar/data/FenwickTree.java)\n\n```\nint[] arr = new int[] {1, 2, 3, 4, 5, 6};\nFenwickTree tree = new FenwickTree(arr);\ntree.queryRange(1, 2);  // =3\n\ntree = new FenwickTree(6);\nfor (int i = 1; i \u003c= 6; i++) {\n   tree.add(i, i);\n}\ntree.queryRange(1, 2);  // =3\n```\n\n### junit\n\n* [IterableConverter](junit/src/main/java/com/asarkar/junit/IterableConverter.java)\n\n```\nclass MyTests {\n  @ParameterizedTest\n  @CsvSource(\n      delimiter = '|',\n      textBlock =\n          \"\"\"\n    [3, 2, 3] | 3\n      \"\"\")\n  public void testSomething(@ConvertWith(IterableConverter.class) int[] nums, int expected) {\n    assertThat(new ClassUnderTest().method(nums)).isEqualTo(expected);\n  }\n}\n```\n\n* [FileSource](junit/src/main/java/com/asarkar/junit/FileSource.java)\n\n```\nclass MyTests {\n  @ParameterizedTest\n  @FileSource(\"/test-file.txt\")\n  public void testSomething(@ConvertWith(IterableConverter.class) int[] nums, int expected) {\n    assertThat(new ClassUnderTest().method(nums)).isEqualTo(expected);\n  }\n}\n```\n\n\u003e src/test/resources/test-file.txt\n\n```\n[3, 2, 3]\n3\n[1]\n2\n```\n\n`@FileSource` may be used along with other JUnit 5 source of arguments, such as `@CsvSource`.\nThe value may contain multiple filenames, and the annotation may be repeated using `@FileSources`.\nIt can convert any valid JSON array to a compatible Java container, even 2D arrays or lists of lists.\n\nSee Javadoc for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasarkar%2Fjdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasarkar%2Fjdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasarkar%2Fjdata/lists"}