Question: Hello, we are learning generics in Java and looking at lists specifically. this is a method to add an item to a list. I don't
Hello, we are learning generics in Java and looking at lists specifically.
this is a method to add an item to a list.
I don't understand how the statement in bold is working. Can anyone please break it down for me and explain how it works with the whole method? many thanks for considering my request.
public void add(T a) {
// if length of the list is equal to the size
// resize the list, then add the element
if (items.length == this.size) {
this.resize();
}
this.items[size] = a;
this.size++;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
