Skip to content

Commit

Permalink
Merge pull request #730 from csmith/master
Browse files Browse the repository at this point in the history
Deprecate TabCompletionMatches.
  • Loading branch information
csmith committed Dec 30, 2016
2 parents 52fa102 + be72ff7 commit d80e8f3
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/main/java/com/dmdirc/ui/input/TabCompletionMatches.java
Expand Up @@ -28,21 +28,19 @@

/**
* Describes a set of matches from a tab completion attempt.
*
* @deprecated This class is dumb. Just use a List.
*/
public class TabCompletionMatches {

/**
* The result list for this tab completer.
*/
private final List<String> results = new ArrayList<>();
@Deprecated
public class TabCompletionMatches extends ArrayList<String> {

/**
* Adds a result to this result set.
*
* @param result The result to be added
*/
public void addResult(final String result) {
results.add(result);
add(result);
}

/**
Expand All @@ -53,7 +51,7 @@ public void addResult(final String result) {
* @return True if this set contains the specified result, false otherwise
*/
public boolean hasResult(final String result) {
return results.contains(result);
return contains(result);
}

/**
Expand All @@ -72,7 +70,7 @@ public void merge(final TabCompletionMatches additional) {
* @return the size of this result set
*/
public int getResultCount() {
return results.size();
return size();
}

/**
Expand All @@ -81,14 +79,14 @@ public int getResultCount() {
* @return An unmodifiable list containing the results
*/
public List<String> getResults() {
return Collections.unmodifiableList(results);
return Collections.unmodifiableList(this);
}

@Override
public String toString() {
final StringBuilder buff = new StringBuilder();

for (String entry : results) {
for (String entry : this) {
if (buff.length() > 0) {
buff.append(", ");
}
Expand Down

0 comments on commit d80e8f3

Please sign in to comment.