Java template programming

M

Mr B.

Hi gurus

I have a C++ template for handling lists I use. It supports practically any
datatype, sorting, undo, commit, etc etc.....
Is it possible to convert/port/whatever to java, or is there any classes
availble for this
Especially undo and commit are key functionality

TIA
LB
 
A

Antti S. Brax

ask@me wrote in comp.lang.java.programmer:
I have a C++ template for handling lists I use. It supports practically any
datatype, sorting, undo, commit, etc etc.....
Is it possible to convert/port/whatever to java, or is there any classes
availble for this

For C++ template like functionality you need to use Java 1.5.

The rest is just code.
 
M

Mr B.

Sorry for probably asking an obvious question
If I enter something like this

template < typename AnyData > class GList {

I get a gazillion error messages ( NeBeans 3.6 )

Any help on this ?
 
M

Mr B.

Yes, you must write in Java, not C++.
It is a DIFFERENT language. Java is similar to C/C++ at the
statement level, but differs in its object/class model.

read http://java.sun.com/developer/technicalArticles/J2SE/generics/ .

Thanks for the link, very usefull...

The examples does not compile, but I checked, and it seems I have java
1.4.xxxx or something, does that mean that I can NOT use templates, the
previous poster said I needed 1.5 ?

And updating is not possible Im afraid !

TIA
 
A

Antti S. Brax

ask@me wrote in comp.lang.java.programmer:
Thanks for the link, very usefull...

The examples does not compile, but I checked, and it seems I have java
1.4.xxxx or something, does that mean that I can NOT use templates, the
previous poster said I needed 1.5 ?

And updating is not possible Im afraid !

Let's start with what Java already provides you.

Have you checked the java.util.List interface and the classes
that implement it (ArrayList, LinkedList and Vector). Does your
own list implementation provide anything (besides transaction
support) that is not implemented by those classes?

If no, is it possible for you to implement your transaction
functionality on top of the standars Java lists by using the
"decorator" design pattern?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,010
Latest member
MerrillEic

Latest Threads

Top