Java multidimensional array for android app -


i doing app have many exercises (for working out) each contain 5 different strings. linked workouts arrays of exercises (but more 1 workout can have same exercise , don't want waste memory), , workouts displayed in different categories (weight loss, body building, etc..).

if doing in c (which language program in) have exercises array of structure called exercise, workout linked lists each link being pointer exercise, int reps , int sets. , workouts organized in array of pointer pointing first element of linked list (so workout can in multiple categories). there way implement in java?

working backwards method in c, why not have like:

class exercise {  private string exname;  private int reps;  private int sets; 

and making constructor:

 public exercise(string newname, int newreps, int newsets) {   exname = newname;   reps = newreps;   sets = newseats; 

that's part different c.

here, you're doing making exercise object contains necessary information, reps , sets.

the constructor makes new instance of object.

then can use regular arraylist list of exercises , list of workouts.

so end can visualize like:

[[exercise1, exercise2, ...][exercise1, exercise2, ....]...] 

so outermost list arraylist of workouts, inner list arraylist of exercises each workout, , each exercise structure contains (optional) name, along list of reps , sets.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -