GGSoft Member Licensed User Longtime User Sep 27, 2019 #1 I am working with a .jar external library and I need to send a java.util.Vector data to one of its methods. How can I cast that type of data or convert a B4X array or a B4X list to a vector? The library's documentation says: Code: Copy public void setNoteList(java.util.Vector newNoteList) Replaces the entire note list with a new note list vector Parameters: Vector - of notes Thanks in advance.
I am working with a .jar external library and I need to send a java.util.Vector data to one of its methods. How can I cast that type of data or convert a B4X array or a B4X list to a vector? The library's documentation says: Code: Copy public void setNoteList(java.util.Vector newNoteList) Replaces the entire note list with a new note list vector Parameters: Vector - of notes Thanks in advance.
stevel05 Expert Licensed User Longtime User Sep 27, 2019 #2 Check the java.util.Vector Docs - https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html, there is a constructor that will create a Vector from a Collection, so using JavaObject it should be : Code: Copy Dim L As List = Array As Int(1,2,3,4,5) Dim Vector As JavaObject Vector.InitializeNewInstance("java.util.Vector",Array(L)) Log(Vector) Upvote 0
Check the java.util.Vector Docs - https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html, there is a constructor that will create a Vector from a Collection, so using JavaObject it should be : Code: Copy Dim L As List = Array As Int(1,2,3,4,5) Dim Vector As JavaObject Vector.InitializeNewInstance("java.util.Vector",Array(L)) Log(Vector)