Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

JAVA Arraylist method?

  • 21-10-2009 09:47PM
    #1
    Closed Accounts Posts: 2


    Howdy, I have a quick question. How would you call an arraylist(from a method) that is in a different class but is in the same package? Im running Eclipse if that makes any difference.


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    You'd have to expose the arraylist as a property on the other class.


  • Registered Users, Registered Users 2 Posts: 1,919 ✭✭✭ronivek


    What do you mean by "call" an ArrayList?

    You probably shouldn't be returning a reference to an ArrayList from an object in general; can't you encapsulate the operations you wish to perform into methods within the Class that contains the ArrayList? And if you can't then maybe you should be looking at your design... although I may be way off track here depending on what it is you're trying to do and the type of application.


Advertisement