Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to create n-new 2D arrays which hold the rows with the same index of n - 2D arrays

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends,

I have been struggling into a problem on my java application and i need some help. I am trying to figure it out how to do it but i am not able to find a way and my brain now is off. What i have is some 2D arrays and each of them is rectangular and of the same size. So let say all are of the size (7X12). Those arrays we took from the method below AllSharesForFiles



So the method above gives me an ArrayList of 2d arrays.Now what i want is to create from these 2D arrays new 2D arrays in which first new 2D array will have all first rows of my previous 2D arrays , the second new 2D array will have all second rows of my previous 2D arrays and so on .

If somebody has an idea of how to achieve it i will really appreciate a lot.
 
Marshal
Posts: 75697
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you can use a List, why do you want to mess around with arrays?
Why have you marked that field static?
I think there is something wrong with your approach, and I think you should start by explaining what you are trying to do. That explanation will probably allow you to find a better solution.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

barlet south wrote:If somebody has an idea of how to achieve it i will really appreciate a lot.


Have a look at Arrays.deepCopy().

However, before you do that, re-read Campbell's post, because he speaketh sense.

What you really need to ask yourself is: Why do I need to do this?

Winston
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic