473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

issue with 2D array

I have following 2D array
Expand|Select|Wrap|Line Numbers
  1. String[][] header = { {"Display Name", "text" }, {"Status", "text"},                 {"Creation  time", "date"  , "Y" },         
  2.         {"Order Number","text"},                                 {"State","text"},                         {"Ticket Number", "text" },                     {"Scenario Name", "text" },                    {" ", " " }
  3.                 };
I want to add one filed after scenario name, So, I created one temp array
String[][] temp = new String[header.length+1][];
Copied the header into temp

Expand|Select|Wrap|Line Numbers
  1. for (int y = 0; y < header.length; y++){                temp[y] = header[y];                    
  2. }
  3. //(System.arraycopy(header, 0, temp, 0, header.length); also used
  4. Then assigned the values,
  5. temp[temp.length-1][0] = " ";
  6. temp[temp.length-1][1] = " ";
  7.  
  8. temp[temp.length-2][0] = "Display Name";
  9. temp[temp.length-2][1] = "text";
then assigned new array to old array

header = temp;

The issue is, the new array containing same value at header.length-1 and header.length-2, i.e, both contains "Display Name" and "text"

I want "Display Name", "text" should be at header.length-2 and " ", " " at header-1.

Can anybody please help me out.

Thanks in advance
Naresh
Aug 10 '09 #1
2 1771
Sorry, inplace of
Expand|Select|Wrap|Line Numbers
  1. temp[temp.length-1][0] = " "; 
I have used

Expand|Select|Wrap|Line Numbers
  1. //temp[temp.length-1][0] = " ";
  2. //temp[temp.length-1][1] = " ";
  3. temp[temp.length-1] = header[header.length-1];
Aug 10 '09 #2
JosAH
11,448 Expert 8TB
Read the API docs for the List interface and its implementing classes.

kind regards,

Jos
Aug 11 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jessica | last post by:
Hi, I have a question regarding the object-oriented issue. I understand that a class is a type. I have an array class. Now say that I want to implement an algorithm A that uses the array class....
8
by: eft0 | last post by:
Hi there, the question: I have this array: var Thumbnails = new Array(); Thumbnails = new Array('1', 'listing_34.jpg', 'Home View'); Thumbnails = new Array('2', 'sexy2.jpg', 'Sexy');...
18
by: ranjeet.gupta | last post by:
Dear ALL As we know that when we declare the union then we have the size of the union which is the size of the highest data type as in the below case the size should be 4 (For my case and...
11
by: ncf | last post by:
Ok, I've been tring to resolve this issue for some time now (~1 day which is way longer than normal for me) to no avail. I am reading a file into a list in memory, using a "%" delimited file...
10
by: Brian Parker | last post by:
I inherited a C++ DLL that I need to remotely call multiple times asynchronously. What I have developed is: CSharp web application that makes asynchronous calls to a CSharp Web Service. The...
4
by: mathieu | last post by:
Hello, I would like implement a nice way to work around the array of references issue in C++. What do usually people do ? Do you maintain a separate factory/pool of elements as part of the API ?...
9
by: Miro | last post by:
VB 2003 and Im still new to vb, so i hope i can explain this as best I can. I have a variable defined as such: ( simple example ) Dim AVariableOfSorts(,) As Object = _ { _ {"Last", "String",...
6
by: daveyand | last post by:
Hey Guys, I've stumped. I created a function that does various things to select boxes. Namely Get All selected indexes, populate array with these values
1
by: chaitanyadotcom | last post by:
As per my application i need to create tabs using iFrame dynamically. There are totally 4 buttons in my application where for each button i provide a link. Where in it will dynamically create a tab...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.