package test;
import java.util.ArrayList;
import java.util.List;
public class testing {
public static void main(String[] args)
{ List<Integer> l= new ArrayList<Integer>();
l.add(1);
l.add(7); l.add(90); l.add(67); int temp; for (int i = 0; i < l.size(); i++) { for (int j =0 ; j < l.size(); j++) {
if(l.get(i)>l.get(j))
{ temp = l.get(i); l.set(i,l.get(j)); l.set(j,temp) ;
}
}
}
for (int i = 0; i < l.size(); i++) { System.out.println(l.get(i)); } } } |
Home
» arrayList
» Coding Problems
» Java
» java program
» Reverse of array list
» sorting of ArrayList
» Tutorial
» How to sort and reverse an array list without using sort method
How to sort and reverse an array list without using sort method
in
arrayList,
Coding Problems,
Java,
java program,
Reverse of array list,
sorting of ArrayList,
Tutorial
- on 01:59:00
- No comments
Post a Comment