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

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

@FunctionalInterface interface CoolStuff {
  void display();
}
abstract class CoolStuff {
  abstract void display();
}

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

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():

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...
    }
  };
}
4 Likes