I’m considering creating the following method:
public static MyBigCollection doSomeStuff(MyBigCollection m) { ... return m; }
and then in another method (perhaps in another class), using it like so:
MyBigCollection mbc = new MyBigCollection();
mbc = stuffClass.doSomeStuff(mbc);
Am I going about this the right way — is this an efficient way to “do some stuff” to an object? I’d like to break off the stuff like so for extensibility. I’ve been doing c# for so long I’m just not sure with java. In c# the method could return void and I can simply call doSomeStuff(mbc) — which would effectively pass my object by reference and do some stuff to it. I’ve been reading that java works differently so I wanted to check with the experts here.
I’d refactor to:
(i.e., a method that modifies mbc and returns void)
Keep in mind that all Java Objects are stored in heap memory, and passed around with reference pointers.