# How should I organise this? 256 array with conditional content - Class?

**URL:** <https://discourse.processing.org/t/how-should-i-organise-this-256-array-with-conditional-content-class/40290>\
**Category:** Libraries\
**Created:** [December 24, 2022, 1:36pm UTC](https://discourse.processing.org/t/how-should-i-organise-this-256-array-with-conditional-content-class/40290 "2022-12-24T13:36:45Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [December 24, 2022, 2:43pm UTC](https://discourse.processing.org/t/how-should-i-organise-this-256-array-with-conditional-content-class/40290/4 "2022-12-24T14:43:43Z")

</div>

If those cool stuffs can fit into a method you could create a base `interface` or `abstract class` w/ 1 `abstract` method **display()**:

```auto
@FunctionalInterface interface CoolStuff {
  void display();
}

```

```auto
abstract class CoolStuff {
  abstract void display();
}

```

Then create a CoolStuff[] array w/ _length_ 256:

```auto
final static int STUFFS = 256;
final CoolStuff[] stuffs = new CoolStuff[STUFFS];

```

And in a separate tab file have a function **createCoolStuffs()** where you anonymous-instantiate your 256 CoolStuff objects.

Each instance would have a different implementation of **display()**:

```auto
void createCoolStuffs() {
  stuffs[0] = new CoolStuff() {
    @Override public void display() {
      // Cool Processing Stuff 000...
    }
  };

  stuffs[1] = new CoolStuff() {
    @Override public void display() {
      // Cool Processing Stuff 001...
    }
  };

  stuffs[2] = new CoolStuff() {
    @Override public void display() {
      // Cool Processing Stuff 002...
    }
  };
}

```

---

_[View the full topic](https://discourse.processing.org/t/how-should-i-organise-this-256-array-with-conditional-content-class/40290)._
