This thing is called "variadic template" in C++ and, unfortunately, is not available in Java. Such a functionality requires implementation of generics as templates while in Java they're implemented using type erasure.
Well, the real guide would be a thick book like C++ Templates: The Complete Guide. But in brief, this is a technique, which allows the compiler to generate classes at compile time using the description of a generic class as a template. With this approach the compiler creates a new class for every type argument passed to template. For example, if your Java code uses List<String> and List<Integer>, both of these classes are actually the same instance of class List with type of contained element erased at compile time. In C++ same types will result in two different classes, where each class has its own set of methods and possibly different internal layout of the class. There are much more details and both approaches are not so simple, but overall high level picture looks as described above. By the way, if you're really interested in gaining more knowledge about C++ templates, the book mentioned above is one of the best among those dedicated to the topic.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This thing is called "variadic template" in C++ and, unfortunately, is not available in Java. Such a functionality requires implementation of generics as templates while in Java they're implemented using type erasure.
What's a template?
Give me a guide to this C++ godsend.
Well, the real guide would be a thick book like C++ Templates: The Complete Guide. But in brief, this is a technique, which allows the compiler to generate classes at compile time using the description of a generic class as a template. With this approach the compiler creates a new class for every type argument passed to template. For example, if your Java code uses
List<String>
andList<Integer>
, both of these classes are actually the same instance of classList
with type of contained element erased at compile time. In C++ same types will result in two different classes, where each class has its own set of methods and possibly different internal layout of the class. There are much more details and both approaches are not so simple, but overall high level picture looks as described above. By the way, if you're really interested in gaining more knowledge about C++ templates, the book mentioned above is one of the best among those dedicated to the topic.