Answering the question in the title line: If you use java.util.Vector<E>
, then it is addElement
. Those would be the closest-match class and method in Java to the C++ template classes that you mentioned in your question.
Docs are here: https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html#addElement-E-
2
solved what is the method equivalent to push_back (C++) in java?