java - Removing elements from ArrayList in ascending order -


I am trying to extract the elements in ArrayList in ascending order. I am down to descending order, but it can not understand it on the other side.

I have tried:

 for  (int r = 0; r   

But it only shows the elements and elements elements made from zero.

So far I have:

  public class test {public static zero main (string) [] args) {Array list & lt; String & gt; s = new arreelist & lt; & Gt; (4); S.add ('a'); S.add ("b"); S.add ('c'); S.add ('d'); Removes elements in descending order for // (int r = s.size () - 1; r> = 0; r -) {System.out.println (s); S.remove (r); } System.out.println (s.size ()); }}   

Any ideas?

You can try this

  array list & lt; String & gt; s = new ArrayList & lt; String & gt; (4); S.add ('a'); S.add ("b"); S.add ('c'); S.add ('d'); // Reverse the array list. Source (S, Collection. Raerserver ()); Iterator & LT; String & gt; I = s.iterator (); While (i.hasNext ()) {System.out.println (i.next ()); I remove(); }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -