0

i am getting multiple items having countdown timers from back end and i am storing those in array list. I want to rearrange them according to decreasing order. Please help me, i am stuck.

  • 1
    Add your relevant code first. – T D Nguyen Apr 14 '16 at 04:46
  • Welcome to SO, please be a bit more specific when asking question: what have you tried, what do you expect, etc. See [how to ask](http://stackoverflow.com/help/how-to-ask) – Nehal Apr 14 '16 at 05:14
  • Hi, i am new to it. Basically i am getting list of countdown timers from backend. I am saving those in arraylist, and setting up adapter. I want to show timers whose value is more than 30 seconds to show at first. How to sort them all. – Abhilasha Sharma Apr 15 '16 at 05:36

2 Answers2

0

So, you want to sort into an array... see: http://www.homeandlearn.co.uk/java/sorting_arrays.html and/or: Java: Sort an array and/or: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#newwindow=1&q=sort+in+array+java

The instruction which can help you to sort an array is:

Arrays.sort(your_array,Collections.reverseOrder());

Good luck :)

Community
  • 1
  • 1
Mihai Coman
  • 73
  • 1
  • 9
0

for a list

Collections.sort(list ,Collections.reverseOrder());

for an array

Arrays.sort(array, Collections.reverseOrder());
Bajirao Shinde
  • 1,356
  • 1
  • 18
  • 26