How do I write an equivalent of this in Java?
// C++ Code
template< class T >
class SomeClass
{
private:
T data;
public:
SomeClass()
{
}
vo
class SomeClass {
private T data;
public SomeClass() {
}
public void set(T data_) {
data = data_;
}
}
You probably also want to make the class itself public, but that's pretty much the literal translation into Java.
There are other differences between C++ templates and Java generics, but none of those are issues for your example.