java - Removing even elements from a list -


this question has answer here:

how can remove elements list of integers?

list dropeven(list l, int n) {      list to_return = nil();     while(true) {         if(l.isempty()) return to_return;         if(n==0) l.remove(n);         integer = (integer)(hd(l));         to_return=append1(to_return,hd(l));         n= n-1;           l=tl(l);     } } 

user iterator , remove values

iterator = l.iterator; int counter = 0; while(i.hasnext()){ i.next(); if (counter%2 == 0) i.remove(); counter++; } 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -