Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
So I ran into a programming philosophy issue and I was wondering what you think about this piece of code:
class Group {
private int nr;
//other fields
//getters/setters
}
private void renumberGroups(List<Group> groups) {
for (int i = 0; i < gruppen.size(); i++) {
gruppen.get(i).setNr(i + 1);
}
}
I want to manipulate a property of each datastruct in a list and I was wondering if doing it this way is okay. Deep in my heart I feel like it would be cleaner if I returned a deepcopy of the structure and make it so that the input isn't manipulated. But that seems a bit excessive to me.
Which approach would you take?
question
java