I mostly use Java and generics are relatively new. I keep reading that Java made the wrong decision or that .NET has better implementations etc. etc.
So, what are the main differences ... |
Java has the generic keyword and C++ provides a very strong programming model with templates.
So then, what is the difference between C++ and Java generics?
|
I am trying to create
ArrayList<int> = new ArrayList<int>();
in Java but that does not work.
Can someone explain why int as type parameter does not work?
Using Integer class for int primitive works, but ... |
This is not a question of what is boxing and unboxing,
it is rather why do languages like Java and C# need that ?
I am greatly familiar wtih C++, STL and Boost.
In ... |
What are the benefits and disadvantages of using generic methods (in compile time, run time, performance, and memory)?
|
Is it possible to call a native CPP function using JNI which takes generic arguments? Something like the following:
public static native <T, U, V> T foo(U u, V v);
And then call ... |
In the Java Generic Book, while contrasting the difference between C++ Templates and Java Generic says:
In C++, a problem arises because >>
without the space denotes the
... |
|
I am little confused on how templates in c++ and generics in java work. it would be helpful if someone explained me how this java code will be c++:
public class Box<T> ...
|
In c++ we can write:
#include <iostream>
class Base1
{
public: void test() { std::cout << "Base 1" << std::endl; }
};
class Base2
{
public: void test() { std::cout << "Base 2" << std::endl; ...
|
I think I can sum up the use of generics in Java in one word: type-safety.
Can you conclude the use of templates in C++ in one word, please?
|
I want something like this:
public abstract class ListenerEx<LISTENER, PARENT> implements LISTENER {
PARENT parent;
public ListenerEx(PARENT p) {
...
|
Here’s my task which I want to solve with as little effort as possible (preferrably with QT & C++ or Java): I want to use webcam video input to detect if ... |
I know quite a bit how to use C++-Templates -- not an expert, mind you. With Java Generics (and Scala, for that matter), I have my diffuculties. Maybe, because I try ... |
I am working with JNI and I have to pass in some generic types to the C++. I am stuck with how to approach this on the C++ side
HashMap<String, ...
|
For a while now I've been looking for a library that can be use to programmatically generate sound effects. I need a library that I can embed in my (mobile) application ... |
How are templated methods implemented in C++?
I'm thinking about implementing templates in the JVM and have got a possible implementation thought out for templated classes, but am unsure on methods.
If, for ... |
I've heard a lot of people saying that C++ templates are very powerful. I still don't seem to understand the advantages of using them instead of using inheritance.
And as I am ... |
class T : public std::string {
public:
T(char* s) : std::string(s){};
};
class X : public T {
public:
...
|
I'm trying to move a paren balancer I wrote in C++ to Java.
I'm trying to implement the stack with an ArrayDeque class from the Deque interface by declaring an ... |
I find the following code remarkable in Java:
ArrayList<String> l1 = new ArrayList<String>();
ArrayList<Integer> l2 = new ArrayList<Integer>();
System.out.println(l1.getClass() == l2.getClass()); // ...
|