# ArrayList of ArrayLists (dynamic 2D array) of custom class

**URL:** <https://discourse.processing.org/t/arraylist-of-arraylists-dynamic-2d-array-of-custom-class/27923>\
**Category:** Beginners\
**Created:** [February 19, 2021, 6:26am UTC](https://discourse.processing.org/t/arraylist-of-arraylists-dynamic-2d-array-of-custom-class/27923 "2021-02-19T06:26:32Z")\
**Posts on this page:** 1\
**Showing post:** 39

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [February 20, 2021, 12:43pm UTC](https://discourse.processing.org/t/arraylist-of-arraylists-dynamic-2d-array-of-custom-class/27923/39 "2021-02-20T12:43:09Z")

</div>

Look again what’s stated on the wiki screenshot I’ve posted earlier:

```auto
// the Foo class must implement the Cloneable interface
// for this code to compile

```

As I’ve warned you before we’ve gotta code our own **clone()** function.

Here’s an example of how to implement a **clone()** method within a class:

> [@Functions argument](https://discourse.processing.org/t/functions-argument/11010/5):
>
> Or even better, use it as an actual full-fledged class, w/ constructors, fields & methods: triumph // https://Discourse.Processing.org/t/functions-argument/11010/5 // GoToLoop (v1.1) (2019/May/09) final Pair pair = new Pair(5, -10); void setup() { println(pair); // [5, -10] println(pair.calc('y')); // [-50, 540] println(pair.set(5, -10)); // [5, -10] println(pair.calc('u')); // [3, -2] println(pair.clone()); // [3, -2] exit(); } static final class…

---

_[View the full topic](https://discourse.processing.org/t/arraylist-of-arraylists-dynamic-2d-array-of-custom-class/27923)._
