haifengl / smile

Statistical Machine Intelligence & Learning Engine
https://haifengl.github.io
Other
5.97k stars 1.13k forks source link

stringVector(0) error #756

Closed li-fcb1899 closed 5 months ago

li-fcb1899 commented 6 months ago

Describe the bug Exception in thread "main" java.lang.ClassCastException: class smile.data.vector.VectorImpl cannot be cast to class smile.data.vector.StringVector (smile.data.vector.VectorImpl and smile.data.vector.StringVector are in unnamed module of loader 'app')

Expected behavior get StringVector

Actual behavior println(stringVector(0).toDate("M/d/yyyy").toArray().contentToString())

Code snippet image

Additional context Orack JDK 21.0.1 Smile-kotlin 3.0.2 Windows

haifengl commented 5 months ago

No need to call toArray(). Use stream instead.