Good day to all! I'm learning Java, trying to understand, there is a task. I would like to understand in which direction to move and whether I think correctly. the task is:
You must create a collection that stores integers. Functional:
- Adding and removing objects by value and by index. (Is it best to use LinkedList here? Right?)
- When adding - all elements of the collection increase by the value of the added element (addition)
- When deleting - all elements of the collection are reduced by the value of the deleted element (subtraction)
in the last two you need to use a for each loop? But I do not understand exactly how best to use it. The problem is more with logic, I can not quite rebuild the brain on it. I understand that it is better to use the wrapping data type ... Can you please tell me if I’m thinking correctly, can you give me an example? Googled