# I want to sort many arrays in many different ways

**URL:** <https://discourse.processing.org/t/i-want-to-sort-many-arrays-in-many-different-ways/34249>\
**Category:** Coding Questions\
**Created:** [December 22, 2021, 6:35pm UTC](https://discourse.processing.org/t/i-want-to-sort-many-arrays-in-many-different-ways/34249 "2021-12-22T18:35:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [December 22, 2021, 7:20pm UTC](https://discourse.processing.org/t/i-want-to-sort-many-arrays-in-many-different-ways/34249/2 "2021-12-22T19:20:33Z")

</div>

The way I see it you work with parallel arrays.

So each data is distributed over two arrays. Therefore you cannot sort one alone but the connected list must change as well.

One way is that you use a class (define a data structure) that holds x and y. Then you make a array of that class.  
Actually that’s basically PVector.

Or make your own class, see text tutorials objects

Then see [How can I sort JSON by ID? - #9 by Chrisir](https://discourse.processing.org/t/how-can-i-sort-json-by-id/15924/9)

---

_[View the full topic](https://discourse.processing.org/t/i-want-to-sort-many-arrays-in-many-different-ways/34249)._
