I have one class "SendBundleQuery" which contains some objects like category , Type , name. category can be of two types base and Addons . Type can be of three types data, voice , sms. I have a arraylist of this class object and now i need to sort in such a was like all base offers will come first and afterwords all Addons. For all base offers order will be data , voice , SMS.
Currently i have sorted it according to category
public int compareTo(SendBundleQuery other) {
int result= category.compareTo(other.category);
if(result==0){
result =other.bundleType.compareTo(bundleType);
}
return result;
}
But now i need to achieve the above condition. What will be the good way to do it.
Below is the example what i want to achieve.
I need to compose sms text for customer like below :
Dear Customer,
You have <0 MB> left within your <Eenmalig 100 MB Maandbundel>. ---Base offer
In addition, you have <22 Minuten> left within your <100 Minuten Bundel>. --- Base offer
In addition, you have <0 MB> left within your <Web 200 MB Maandbundel>. --Addon
In addition, you have <35 MB> left within your <Alles-in-1 op Reis Data Dagbundel>. --Addon
In addition, you have <374 MB> left within your <Blox 400 MB Maandbundel>. --Addon
In addition, you have <20 Minuten> left within your <Alles-in-1 Op Reis 20 Minuten gesprekken ontvangen>. --Addon
In addition, you have <20 Minuten> left within your <Alles-in-1 Op Reis 20 Minuten Bellen>. --Addon
In addition, you have <20 SMS> left within your <Alles-in-1 Op Reis 20 SMS Dagbundel>. --Addon
These credits are updated until <12-12-2014> at <14.53>.
Maintain your BloX and extra’s in My Vodafone.
Below is the current result but the order is like data , sms and then voice but i need data , voice and then sms:
Dear Customer,
You have 0.0 MB Data left within your Web 500 MB Maandbundel.
In addition, you have 106 minutes left within your 150 Minuten Bundel.
In addition, you have 35.0 MB Data left within your Alles-in-1 op Reis Data Dagbundel.
In addition, you have 20 messages left within your Alles-in-1 Op Reis 20 SMS Dagbundel.
In addition, you have 20 minutes left within your Alles-in-1 Op Reis 20 Minuten gesprekken ontvangen.
In addition, you have 20 minutes left within your Alles-in-1 Op Reis 20 Minuten Bellen.
These credits are updated until 15-12-2014 at 03:57.
Maintain your BloX and extras in My Vodafone.