Skip to content

Instantly share code, notes, and snippets.

@Reacoder
Created August 11, 2014 10:30
Show Gist options
  • Save Reacoder/edbb688c45e608465b8d to your computer and use it in GitHub Desktop.
Save Reacoder/edbb688c45e608465b8d to your computer and use it in GitHub Desktop.
List<Fruit> fruits= new ArrayList<Fruit>();
Fruit fruit;
for(int i=0;i<100;i++)
{
fruit = new fruit();
fruit.setname(...);
fruits.add(fruit);
}
//Sorting
Collections.sort(fruits, new Comparator<Fruit>() {
@Override
public int compare(Fruit fruite1, Fruit fruite2)
{
return fruite1.fruitName.compareTo(fruite2.fruitName);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment