Hi there! I'm stumped on how to make get() method for an Arraylist in Java.
private ArrayList<Shipment> shipmentList = new ArrayList<>();
Say I have the above and need methods in which to add and extract from the array. I'm aware of how to add values manually but stuck as how to actually start it, it's been challenging finding generic examples of that. I understand I'm trying to make a method in which to have the program select the array list and the value within the array index position and pull it.
Here is the full class as part of a larger program I'm working on; I don't need any other answers regarding the rest of the class, even just links to some resources to understand how to do this would be great.
- shipmentList : ArrayList<Shipment>
+ get(index : int) : Shipment
+ add(shipment : Shipment) : void
+ findShipment(destination : Destination) : int
+ length() : int
+ toString() : String