ArrayList sorting/sıralama
// Arraylist sorting/sıralama
List<Fruit> fruits = new ArrayList<Fruit>();
Fruit fruit;
// Adding to list
for(int i=0 ; i<100 ; i++){
fruit = new Fruit();
fruit.setName("Apple");
fruits.add(fruit);
}
//Sorting
Collections.sort(fruits, new Comparator<Fruit>() {
@Override
public int compare(Fruit object1, Fruit object2){
return object1.fruitName.compareTo(object2.fruitName);
}
});
Created 8 years ago by Ahmet Faruk Bişkinler
Last Updated 8 years ago by Ahmet Faruk Bişkinler