Android Java How to properly remove int from list? -


currently trying write code create list various points coordinates , remove 3 smallest ints list. when run app, crashes. figured out happens in remove part. have looked other similar threads, solution similar have. here's code have:

    list<integer> xpoint = arrays.aslist(a.x, b.x, c.x, d.x, e.x, f.x, g.x, k.x);     list<integer> xpleft = arrays.aslist();     int xplefttimes = 0;      //find 3 min x values(left)     while(xplefttimes != 2){     int left = collections.min(xpoint);     xpoint.remove(left); <-app crashes here     xpleft.add(left);     xplefttimes++;     } 

enter image description here

what doing wrong? in advance.

arrays.aslist() returns fixed-size list backed specified array.

try

list<integer> xpoint = new arraylist(arrays.aslist(a.x, b.x, c.x, d.x, e.x, f.x, g.x, k.x)); 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -