OSDN Git Service

Replace TreeSet with HashSet.
authorPrzemyslaw Szczepaniak <pszczepaniak@google.com>
Thu, 11 Sep 2014 15:10:32 +0000 (16:10 +0100)
committerPrzemyslaw Szczepaniak <pszczepaniak@google.com>
Thu, 11 Sep 2014 15:56:46 +0000 (16:56 +0100)
Both Locale and Voice do not implement Comparable.

Bug: 17467923
Change-Id: I683577e5b18ae1892e1ccea5ea241e1d016c9517

core/java/android/speech/tts/TextToSpeech.java

index a4b6e92..9be220e 100644 (file)
@@ -46,7 +46,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.MissingResourceException;
 import java.util.Set;
-import java.util.TreeSet;
 
 /**
  *
@@ -1567,10 +1566,10 @@ public class TextToSpeech {
             @Override
             public Set<Locale> run(ITextToSpeechService service) throws RemoteException {
                 List<Voice> voices = service.getVoices();
-                if (voices != null) {
-                    return new TreeSet<Locale>();
+                if (voices == null) {
+                    return new HashSet<Locale>();
                 }
-                TreeSet<Locale> locales = new TreeSet<Locale>();
+                HashSet<Locale> locales = new HashSet<Locale>();
                 for (Voice voice : voices) {
                     locales.add(voice.getLocale());
                 }
@@ -1593,7 +1592,7 @@ public class TextToSpeech {
             @Override
             public Set<Voice> run(ITextToSpeechService service) throws RemoteException {
                 List<Voice> voices = service.getVoices();
-                return (voices != null)  ? new TreeSet<Voice>(voices) : new TreeSet<Voice>();
+                return (voices != null)  ? new HashSet<Voice>(voices) : new HashSet<Voice>();
             }
         }, null, "getVoices");
     }