B B4JExplorer Active Member Licensed User Longtime User Jul 21, 2017 #1 Sets don't have a get() method, because of the non-order. Do I need to use an Iterator JavaObject, or is there a more direct way?
Sets don't have a get() method, because of the non-order. Do I need to use an Iterator JavaObject, or is there a more direct way?
K keirS Well-Known Member Licensed User Longtime User Jul 21, 2017 #2 You can use a iterator or convert the set to an array. Upvote 0
B B4JExplorer Active Member Licensed User Longtime User Jul 21, 2017 #3 keirS said: You can use a iterator or convert the set to an array. Click to expand... I'm trying to minimize the number of JavaObjects, which I would need to use for an Iterator. So the only other way, is to do a conversion first, to an array? Ok, thanks. Upvote 0
keirS said: You can use a iterator or convert the set to an array. Click to expand... I'm trying to minimize the number of JavaObjects, which I would need to use for an Iterator. So the only other way, is to do a conversion first, to an array? Ok, thanks.
B B4JExplorer Active Member Licensed User Longtime User Jul 21, 2017 #4 I thought for sure, it would be more complicated than this. But this works fine B4X: Private jo_Iterator As JavaObject jo_Iterator = jo_Structure.RunMethod( "iterator", Null ) Private jo_Element As JavaObject Do While jo_Iterator.RunMethod( "hasNext", Null ) jo_Element = jo_Iterator.RunMethod( "next", Null ) Log( "Next Element " & jo_Element ) Loop Issue closed. Upvote 0
I thought for sure, it would be more complicated than this. But this works fine B4X: Private jo_Iterator As JavaObject jo_Iterator = jo_Structure.RunMethod( "iterator", Null ) Private jo_Element As JavaObject Do While jo_Iterator.RunMethod( "hasNext", Null ) jo_Element = jo_Iterator.RunMethod( "next", Null ) Log( "Next Element " & jo_Element ) Loop Issue closed.