162b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung/*
262b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * Copyright (C) 2013 The Android Open Source Project
362b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung *
462b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * Licensed under the Apache License, Version 2.0 (the "License");
562b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * you may not use this file except in compliance with the License.
662b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * You may obtain a copy of the License at
762b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung *
862b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung *      http://www.apache.org/licenses/LICENSE-2.0
962b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung *
1062b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * Unless required by applicable law or agreed to in writing, software
1162b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * distributed under the License is distributed on an "AS IS" BASIS,
1262b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1362b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * See the License for the specific language governing permissions and
1462b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung * limitations under the License.
1562b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung */
1662b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kungpackage com.android.deskclock.worldclock;
1762b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung
1862b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kungimport java.text.Collator;
1962b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kungimport java.util.Comparator;
2062b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung
2162b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kungpublic class CityNameComparator implements Comparator<CityObj> {
2262b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung
23d24d9e3c7cd03cd03dc87002ee5af5fee2bfa0fbJames Kung    private Collator mCollator;
24d24d9e3c7cd03cd03dc87002ee5af5fee2bfa0fbJames Kung
25d24d9e3c7cd03cd03dc87002ee5af5fee2bfa0fbJames Kung    public CityNameComparator() {
26d24d9e3c7cd03cd03dc87002ee5af5fee2bfa0fbJames Kung        mCollator = Collator.getInstance();
27d24d9e3c7cd03cd03dc87002ee5af5fee2bfa0fbJames Kung    }
28d24d9e3c7cd03cd03dc87002ee5af5fee2bfa0fbJames Kung
2962b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung    @Override
3062b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung    public int compare(CityObj c1, CityObj c2) {
31d24d9e3c7cd03cd03dc87002ee5af5fee2bfa0fbJames Kung        return mCollator.compare(c1.mCityName, c2.mCityName);
3262b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung    }
3362b9f3d89a2be17f70d2fe45c1c94f732e0224a4James Kung}
34