Avatar of eternity5219
eternity5219

asked on 

add integer to array list (URGENT)

HI experts,
 I want to create a 2d array of time array list, called Darray
ArrayList [][] DArray= new ArrayList [9][9];
and then give it values
DArray[i][j].add((int)board[i][j]);
which the value is integer value of a 2d array
but it gives me compilation error
any idea how to fix it?
JavaProgramming Languages-Other

Avatar of undefined
Last Comment
TimYates
SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of eternity5219
eternity5219

ASKER

ArrayList<Integer> [][] DArray= new ArrayList<Integer> [9][9];
 this one gives error (I use eclipse)

error is : (cannot create a generic array of  arraylist)
SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
ASKER CERTIFIED SOLUTION
Avatar of nayernaguib
nayernaguib
Flag of Egypt image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of eternity5219
eternity5219

ASKER

yes I want a 9by 9 matrix of arrayList
SOLUTION
Avatar of nayernaguib
nayernaguib
Flag of Egypt image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of eternity5219
eternity5219

ASKER

81 ArrayLists each acting as a one-dimensional array
I need to solve Sudoku with arc consistenct method, so what I really need to do is to check each cell and save all of the possible numbers for that position in one array, there could be only one number or several number, but the problem is, I have my initial sudoku board as a 2 D array, and there are some filled cells on it, which I need to move those numbers into my 3d array ,(or I was thinking about 2d Arraylist),
and I cant do this becuz I cant assign and int value to arraylist,
SOLUTION
Avatar of contactkarthi
contactkarthi
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo