Skip to content

Commit 8e13024

Browse files
committed
Remove an unnecessary check when choosing the best candidate
1 parent e51d5e4 commit 8e13024

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/xatkit/core/recognition/AbstractIntentRecognitionProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,9 @@ protected abstract RecognizedIntent getIntentInternal(@NonNull String input, @No
208208
*/
209209
protected RecognizedIntent getBestCandidate(@NonNull Collection<RecognizedIntent> recognizedIntents,
210210
@NonNull StateContext context) {
211-
checkArgument(!recognizedIntents.isEmpty(), "Cannot get the best candidate from the provided collection: the "
212-
+ "collection is empty");
211+
//This checkArgument seems unnecessary as the stream filter already includes and else that can cover this
212+
// scenario
213+
//checkArgument(!recognizedIntents.isEmpty(), "Cannot get the best candidate from the provided collection: the collection is empty");
213214
RecognizedIntent bestCandidate =
214215
recognizedIntents.stream()
215216
.sorted(Comparator.comparingDouble(RecognizedIntent::getRecognitionConfidence).reversed())

0 commit comments

Comments
 (0)