The generic counterpart of the
ArrayList type is the generic
List<T> type, where the type parameter
T stands for, unsurprisingly, the element type. Available methods on
List<T> are pretty much the same as on
ArrayList. We can even easily port our
ArrayList example to
You might have noticed before in the examples of nongeneric collection types that I’ve been using named parameters sometimes. This isn’t necessary to make the preceding code compile but serves as a form of documentation for the meaning of used ...