APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

How to use ArrayList? post and replies

Return to the How to use ArrayList? thread
Login to post to this thread

ArrayList usage
Eduard Saakashvili
1 Posts

Hi,
We're trying to create and use an ArrayList. Do we declare one in the variables tab? Do we have to import something? Right now, we are able to declare an ArrayList in variables, but it does not work when we try to run the ArrayList.add() function.
Thanks!


Replies to ArrayList usage

Re: ArrayList usage -
Francisco Esquembre
228 Posts

Try qualifying completely the class, as in

java.utils.ArrayList

Alternatively, you can add this class to the "Imports" list in the simulation information dialog (icon at the top-right), in its "Run options" tab. Then, you can just use ArrayList as the name of the class.

Paco



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book