We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62acfbc commit d1133dcCopy full SHA for d1133dc
spring-ai-model/src/main/java/org/springframework/ai/model/EmbeddingUtils.java
@@ -39,7 +39,17 @@ public static List<Float> doubleToFloat(final List<Double> doubles) {
39
}
40
41
public static float[] toPrimitive(List<Float> floats) {
42
- return toPrimitive(floats.toArray(new Float[floats.size()]));
+ if (floats == null) {
43
+ return null;
44
+ }
45
+ if (floats.isEmpty()) {
46
+ return EMPTY_FLOAT_ARRAY;
47
48
+ final float[] result = new float[floats.size()];
49
+ for (int i = 0; i < result.length; i++) {
50
+ result[i] = floats.get(i);
51
52
+ return result;
53
54
55
public static float[] toPrimitive(final Float[] array) {
0 commit comments