Kaynağa Gözat

Merge pull request #730 from csmith/master

Deprecate TabCompletionMatches.
pull/731/head
Chris Smith 7 yıl önce
ebeveyn
işleme
d80e8f38c0

+ 9
- 11
src/main/java/com/dmdirc/ui/input/TabCompletionMatches.java Dosyayı Görüntüle

@@ -28,13 +28,11 @@ import java.util.List;
28 28
 
29 29
 /**
30 30
  * Describes a set of matches from a tab completion attempt.
31
+ *
32
+ * @deprecated This class is dumb. Just use a List.
31 33
  */
32
-public class TabCompletionMatches {
33
-
34
-    /**
35
-     * The result list for this tab completer.
36
-     */
37
-    private final List<String> results = new ArrayList<>();
34
+@Deprecated
35
+public class TabCompletionMatches extends ArrayList<String> {
38 36
 
39 37
     /**
40 38
      * Adds a result to this result set.
@@ -42,7 +40,7 @@ public class TabCompletionMatches {
42 40
      * @param result The result to be added
43 41
      */
44 42
     public void addResult(final String result) {
45
-        results.add(result);
43
+        add(result);
46 44
     }
47 45
 
48 46
     /**
@@ -53,7 +51,7 @@ public class TabCompletionMatches {
53 51
      * @return True if this set contains the specified result, false otherwise
54 52
      */
55 53
     public boolean hasResult(final String result) {
56
-        return results.contains(result);
54
+        return contains(result);
57 55
     }
58 56
 
59 57
     /**
@@ -72,7 +70,7 @@ public class TabCompletionMatches {
72 70
      * @return the size of this result set
73 71
      */
74 72
     public int getResultCount() {
75
-        return results.size();
73
+        return size();
76 74
     }
77 75
 
78 76
     /**
@@ -81,14 +79,14 @@ public class TabCompletionMatches {
81 79
      * @return An unmodifiable list containing the results
82 80
      */
83 81
     public List<String> getResults() {
84
-        return Collections.unmodifiableList(results);
82
+        return Collections.unmodifiableList(this);
85 83
     }
86 84
 
87 85
     @Override
88 86
     public String toString() {
89 87
         final StringBuilder buff = new StringBuilder();
90 88
 
91
-        for (String entry : results) {
89
+        for (String entry : this) {
92 90
             if (buff.length() > 0) {
93 91
                 buff.append(", ");
94 92
             }

Loading…
İptal
Kaydet