{"id":35012222,"url":"https://github.com/forax/struct-of-array","last_synced_at":"2026-05-19T21:02:08.279Z","repository":{"id":58311807,"uuid":"526996104","full_name":"forax/struct-of-array","owner":"forax","description":"Two data structures with the API of an array of structs (AoS) and the internals of a struct of arrays (SoA)","archived":false,"fork":false,"pushed_at":"2023-04-20T06:12:02.000Z","size":85,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-28T18:51:57.167Z","etag":null,"topics":["data-structures","game-development","java","struct-of-arrays"],"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/forax.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}},"created_at":"2022-08-20T17:33:44.000Z","updated_at":"2024-05-09T14:30:57.000Z","dependencies_parsed_at":"2023-01-17T19:00:54.828Z","dependency_job_id":null,"html_url":"https://github.com/forax/struct-of-array","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/forax/struct-of-array","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forax%2Fstruct-of-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forax%2Fstruct-of-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forax%2Fstruct-of-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forax%2Fstruct-of-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forax","download_url":"https://codeload.github.com/forax/struct-of-array/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forax%2Fstruct-of-array/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33233087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T15:49:41.270Z","status":"ssl_error","status_checked_at":"2026-05-19T15:49:22.917Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["data-structures","game-development","java","struct-of-arrays"],"created_at":"2025-12-27T05:00:07.970Z","updated_at":"2026-05-19T21:02:08.224Z","avatar_url":"https://github.com/forax.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# struct-of-array\nTwo data structure with the API of an array of structs (AoS) and the internals of a\n[struct of arrays (SoA)](https://en.wikipedia.org/wiki/AoS_and_SoA)\n\nThe API provides two data structure, a `StructOfArrayList` that have an API similar to an `ArrayList`\nof records but stores the components of the record in different arrays and a `StructOfArrayMap`\nthat works like `HashMap` of integers (a sparse array) using the same destructuring.\n\n```java\n  record Person(int age, String name) {}\n  \n  var soaList = StructOfArrayList.of(MethodHandles.lookup(), Person.class);\n  soaList.add(new Person(36, \"Ana\"));\n  soaList.add(new Person(18, \"Bob\"));\n  System.out.println(soaList.get(0));  // Person[36, Ana]\n```\n\nInternally, the list stores an array of ints for the ages and an array of objects (the reference types are erased)\nfor the names.\n\nAnd a similar example using `StructOfArrayMap`\n```java\n  var soaMap = StructOfArrayMap.of(MethodHandles.lookup(), Person.class);\n  soaMap.put(10, new Person(36, \"Ana\"));\n  soaMap.put(6, new Person(18, \"Bob\"));\n  System.out.println(soaList.get(6));  // Person[18, Bob]\n```\n\n\n### How to build ?\nJust use Maven with Java 17+\n```bash\n  mvn package\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforax%2Fstruct-of-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforax%2Fstruct-of-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforax%2Fstruct-of-array/lists"}