2929import java .util .ArrayList ;
3030import java .util .Arrays ;
3131import java .util .Collection ;
32- import java .util .Collections ;
3332import java .util .Comparator ;
3433import java .util .HashSet ;
3534import java .util .List ;
@@ -55,7 +54,6 @@ public abstract class SuggestionProvider<T> implements Callback<ISuggestionReque
5554 /**
5655 * Create a default suggestion provider based on the toString() method of the generic objects
5756 * @param possibleSuggestions All possible suggestions
58- * @return
5957 */
6058 public static <T > SuggestionProvider <T > create (Collection <T > possibleSuggestions ) {
6159 return create (null , possibleSuggestions );
@@ -67,7 +65,6 @@ public static <T> SuggestionProvider<T> create(Collection<T> possibleSuggestions
6765 *
6866 * @param stringConverter A stringConverter which converts generic T into a string
6967 * @param possibleSuggestions All possible suggestions
70- * @return
7168 */
7269 public static <T > SuggestionProvider <T > create (Callback <T , String > stringConverter , Collection <T > possibleSuggestions ) {
7370 SuggestionProviderString <T > suggestionProvider = new SuggestionProviderString <>(stringConverter );
@@ -77,15 +74,13 @@ public static <T> SuggestionProvider<T> create(Callback<T, String> stringConvert
7774
7875 /**
7976 * Add the given new possible suggestions to this SuggestionProvider
80- * @param newPossible
8177 */
8278 public void addPossibleSuggestions (@ SuppressWarnings ("unchecked" ) T ... newPossible ) {
8379 addPossibleSuggestions (Arrays .asList (newPossible ));
8480 }
8581
8682 /**
8783 * Add the given new possible suggestions to this SuggestionProvider
88- * @param newPossible
8984 */
9085 public void addPossibleSuggestions (Collection <T > newPossible ) {
9186 synchronized (possibleSuggestionsLock ) {
@@ -113,39 +108,21 @@ public final Collection<T> call(final ISuggestionRequest request) {
113108 }
114109 }
115110 }
116- Collections .sort (suggestions , getComparator ());
111+ suggestions .sort (getComparator ());
117112 }
118113 return suggestions ;
119114 }
120115
121-
122- /***************************************************************************
123- * *
124- * Static methods *
125- * *
126- **************************************************************************/
127-
128116 /**
129117 * Get the comparator to order the suggestions
130- * @return
131118 */
132119 protected abstract Comparator <T > getComparator ();
133120
134121 /**
135122 * Check the given possible suggestion is a match (is a valid suggestion)
136- * @param suggestion
137- * @param request
138- * @return
139123 */
140124 protected abstract boolean isMatch (T suggestion , ISuggestionRequest request );
141125
142-
143- /***************************************************************************
144- * *
145- * Default implementations *
146- * *
147- **************************************************************************/
148-
149126 /**
150127 * This is a simple string based suggestion provider.
151128 * All generic suggestions T are turned into strings for processing.
@@ -166,18 +143,14 @@ public int compare(T o1, T o2) {
166143
167144 /**
168145 * Create a new SuggestionProviderString
169- * @param stringConverter
170146 */
171147 public SuggestionProviderString (Callback <T , String > stringConverter ) {
172148 this .stringConverter = stringConverter ;
173149
174150 // In case no stringConverter was provided, use the default strategy
175151 if (this .stringConverter == null ) {
176- this .stringConverter = new Callback <T , String >() {
177- @ Override
178- public String call (T obj ) {
179- return obj != null ? obj .toString () : "" ; //$NON-NLS-1$
180- }
152+ this .stringConverter = obj -> {
153+ return obj != null ? obj .toString () : "" ; //$NON-NLS-1$
181154 };
182155 }
183156 }
0 commit comments