![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 | |
|
Professional Programmer
|
Quote:
Such as: myArray.add(5);
if (myArray.get(0) == 5) {
System.out.println("Yep, it was 5");
} |
|
|
|
|
|
|
#22 |
|
Expert Programmer
|
Ok... how come
ArrayList[][] possible = new ArrayList[9][9]; ArrayList<Byte>[][] possible = new ArrayList<Byte>[9][9]; |
|
|
|
|
|
#23 |
|
Programmer
Join Date: Nov 2004
Posts: 84
Rep Power: 4
![]() |
Shouldn't it be declared like this?
ArrayList<Byte>[][] possible = new ArrayList[9][9];
__________________
HijackThis Team-SFDC |
|
|
|
|
|
#24 |
|
Programmer
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 3
![]() |
you have to declare it with <> because ArrayList is a template class which allow you to create ArrayList of any data type. I hope i am not wrong ^_^
|
|
|
|
|
|
#25 |
|
Hobbyist Programmer
Join Date: Nov 2005
Posts: 149
Rep Power: 3
![]() |
I had to declare my ArrayList like this:
ArrayList<MyPoint> points=new ArrayList<MyPoint>(); |
|
|
|
|
|
#26 |
|
Programmer
Join Date: Aug 2005
Location: 0x0010 * 0x0091 + 0x0004
Posts: 65
Rep Power: 3
![]() |
Or you can go oldschool 1.4.2 and don't use the template. Then you could just declare an ArrayList object and add new Integer objects too it (called a wrapper class).
__________________
#if 0 /* in case someone actually tries to compile this */ <Jim_McNeat> Is there like a way to put a compiler in "Just trust me on that one" mode? |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|