Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Array of generic List?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="googmeister, post: 618230"] public class MyClass { Unfortunately, Java disallows generic array creation. The best work-around is to do something like the following (which I suspect is similar to your solution): public class MyClass { private List[] myFoos; public MyClass() { myFoos = new List[5]; } Then, when it comes time to remove a list element, you'll need to cast it back to type Foo. Sorry, Java screwed this one up pretty badly (in my opinion). [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Array of generic List?
Top