Possible to add structure var to arraylist?

Stellaferox

Active Member
Licensed User
Hi,

Is it possible to add a structure variable (say Point.X and Point.Y in Point) to an arraylist? If yes how do I retrieve this item in a dummy variable.
thnx in advance,
Marc
 

mjcoon

Well-Known Member
Licensed User
I think not. That would require a real object-oriented language.

But you could have two ArrayLists, called, say, AListX and AListY, and always treat them in parallel.

(I have just done this with stacks which hold X and Y offsets and a scale factor, for un-zooming.)

HTH, Mike.
 

Stellaferox

Active Member
Licensed User
Hi Mike,

Yes, I used that workaround too. But the thing is that I want more then two subtypes in the variable and that would mean up to 10 parallel arraylists with all the handling thereafter.
Still puzzled how to solve this otherwise....

Is there an equivalent of LinkedList in JAVA in B4PPC?
Marc
 

mjcoon

Well-Known Member
Licensed User
Still puzzled how to solve this otherwise....

My only other suggestion is the rather obvious and clunky one of storing the elements as a concatenated string with some separator guaranteed to be absent from the data (perhaps null?) and parse it when fetched...

Mike.
 

corwin42

Expert
Licensed User
Longtime User
Yes, I used that workaround too. But the thing is that I want more then two subtypes in the variable and that would mean up to 10 parallel arraylists with all the handling thereafter.
Still puzzled how to solve this otherwise....

The possible solutions I can think of are using more than one ArrayList as suggested above or use an invisible Table Control to store your data. If you have to store lots of data and need to manipulate it, a table control is quite slow and then I would use an in memory SQL-Database which I have used successfully in the past.
 

Stellaferox

Active Member
Licensed User
There is a lot of data to go around and what's more, not known upfront how much. The idea of a concatenated string is also usable. I did that in other apps. Thanx guys, guess there is still something on the wishlist.....
Marc
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…