I am currently moving from C ++ to Java to work, and I am having difficulty without const and pointers to make sure the goal is always clear. One of the biggest problems I am facing is returning an object with a changed type.
Take, for example, the filter function. It was used to filter values.
public List<int> filter(List<Integer> values) {
...
}
Everything is serialized here, so we can first copy the entire list, then change the contents and return it. It seems a little pointless inefficient. Especially if this list is large. Also copying your inputs every time looks pretty awkward.
We could pass it in normal mode, change it and make it clear that we are doing this on behalf of:
public void modifyInputListWithFilter(List<Integer> values) {
...
}
, - , , . .
List - , , . , , .
List , . , , . , , , List, , .
?