I have an object 'liman', liman contains ships and containers in ArrayLists. I'm trying to fill the ArrayLists from a text file which goes like this:
1574683 Abyssinia
8546279 Royal_Oak
2454438 Oceanway
9146578 Atilgan
3378841 Albatros
6562152 Imbat
1000085321 N N
1000255963 N N
1000511926 N N
1000853210 N N
1001279815 N N
1001791741 N N
1002388988 N N
...
This file has 6 ships, their IMOs and their names. It has 624 containers, their serial numbers and two features. Here's my method:
This code successfully creates containers and adds them to the liman's ArrayList for containers. It's the same for the ships as well, but it creates the ships twice. So liman's ArrayList for ships contains the same ship twice, the size of the arraylist is 12. What am I doing wrong? (by the way, I'm a rookie)