Skip to content

Commit

Permalink
Remove unnecessary empty string checks
Browse files Browse the repository at this point in the history
Signed-off-by: Zan Niu <[email protected]>
  • Loading branch information
zane-neo committed Oct 24, 2022
1 parent 748c425 commit c083a7c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ private void createInferenceListForMapTypeInput(Object sourceValue, List<String>
if (sourceValue instanceof Map) {
((Map<String, Object>) sourceValue).forEach((k, v) -> createInferenceListForMapTypeInput(v, texts));
} else if (sourceValue instanceof List) {
((List<String>) sourceValue).stream().filter(StringUtils::isNotBlank).forEach(texts::add);
texts.addAll(((List<String>) sourceValue));
} else {
if (sourceValue == null || StringUtils.isBlank(sourceValue.toString())) return;
if (sourceValue == null) return;
texts.add(sourceValue.toString());
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@ Map<String, Object> buildTextEmbeddingResult(
for (Map.Entry<String, Object> knnMapEntry : knnMap.entrySet()) {
String knnKey = knnMapEntry.getKey();
Object sourceValue = knnMapEntry.getValue();
if (sourceValue instanceof String && StringUtils.isNotBlank(sourceValue.toString())) {
if (sourceValue instanceof String) {
List<Float> modelTensor = modelTensorList.get(indexWrapper.index++);
result.put(knnKey, modelTensor);
} else if (sourceValue instanceof List) {
Expand Down

0 comments on commit c083a7c

Please sign in to comment.