• Post Reply Bookmark Topic Watch Topic
  • New Topic

An array of multidimensional arrays?  RSS feed

 
Anurag Bhatt
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

First post

I was solving a programming problem on a website and I hit a roadblock for the specific problem that I have to solve. The problem is of a command line image editor. Each image is a multidimensional array.

Now the problem is, I have to store images dynamically in a multidimensional array every time the user hits a save command. Since the user can save multiple times, I would have multiple images to store. Along with the image itself, the array would also contain the number of the image.

This was what I thought of - a three dimensional array looking like this:

1 2 3 4
_ 3 4 5
_ 5 6 7
2 6 7 8
_ 7 8 9

Here, the left most column is the number of the image, while the block of numbers next to it is the image itself. The new image starts at the next number.

I'd like to know how to make such an array. Also, if a more efficient way of working things out is possible, I'd be very glad to listen to suggestions.

Thanks
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just create an image class with the image array as a field. Then store each one in an List (or maybe a Stack would be more appropriate if you're talking about undos).

What do I win?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch Anurag
 
Anurag Bhatt
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luigi Plinge wrote:Just create an image class with the image array as a field. Then store each one in an List (or maybe a Stack would be more appropriate if you're talking about undos).

What do I win?


Oh yeah. No undos involved so a List it shall be.

Thanks

Seetharaman Venkatasamy wrote:Welcome to JavaRanch Anurag


Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!