java - How to store a List with own data type in an object array list -


i have list listobject , want store list pointlistforobject every object of listobject. how can make work?

class points {     private int start;     private int stop;      public points() {         start = 0;         stop = 0;     }      setter , getter...   }   list<object[]> listobject = new arraylist<object[]>;  list<points> pointlistforobject = new arraylist<points>;     ...     points point= new point();     point.setstart(1);     point.setstop(2);      pointlistforobject.add(point);     listobject.get(0)[1] = pointlistforobject; 

and want points in method back, don't know how cast or convert in right way. idea is:

list<points> usepointsofobject = (list<points>) listobject.get(0)[1]; 

and here an: exception in thread "main" java.lang.classcastexception: [ljava.lang.object; cannot cast java.util.list

i tried different possibilities(to cast or convert) know doesn't work have no ideas..

after

pointlistforobject.add(point);

you should have object[] objarr=list.toarray(new object[pointlistforobject.size()]);

then listobject.add(objarr);


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -