I'm wondering if there's an issue with keeping an ArrayList of objects of the type defined in the same class.
I've implemented the following, and with some test data it works fine.. except I get a Netbeans warning "leaking this in constructor"
I can't get much info on this error.. does anyone have any thoughts?
For the record, it's not a serious program or anything.. I was just wondering if it could be done.
Thanks as always guys =)
I've implemented the following, and with some test data it works fine.. except I get a Netbeans warning "leaking this in constructor"
I can't get much info on this error.. does anyone have any thoughts?
For the record, it's not a serious program or anything.. I was just wondering if it could be done.
Code:
public class Widget {
// some vars...
private static ArrayList<Widget> widgetList = new ArrayList<Widget>();
public Widget {
//set some stuff...
widgetList.add(this);
}
}
Thanks as always guys =)