first i want to thank you Sir phillipe for this effort to help people by posting source code of data mining algorithms.
my question Sir if there is no problem of course.it is about algorithm Charm source code : i am very native whith java and i don't understand what means by this declaration of varaiables ex:private List childNodes = new ArrayList<ITNode>(); from the file ITNode.java
my pb is with "<ITNode >" is it kind of declaration ??? because in "eclipse" it consider it as a mistack .and this is the same thing with all what is enter <and >;
I'm sorry for the late reply. Normally, I answer more quickly. But I was busy this week.
To answer your question:
List childNodes = new ArrayList<ITNode>();
It means that we create a list of ITNodes. If you don't write <ITNode> it would also works. But the compiler would not know that this list contains ITNode objects and you would need to always use a "cast" when you want to access objects from the list.
I will give you an example. If you write like what I did:
List childNodes = new ArrayList<ITNode>();
Then, if you want to acess the first item, you will do:
ITNode node = (ITNode) childNodes.get(0);
If you want to do a for loop, you can write like this:
for(ITNode node : childNodes) { ....}
But if you do like this:
List childNodes = new ArrayList<ITNode>();
Then, if you want to acess the first item, you will do:
ITNode node = childNodes.get(0);
and if you want to make a for loop, you will have to do like that:
This feature of Java is called "generics". It makes your code more pretty. It will also make sure that you never add any other kinds of objects in your list that you created it for.
For example, if you add an object Integer in the childNodes list, it will give you an error. But if you did not use <ITNode> when you created the list, the compiler will not give you an error.
Hi webmasterphilfv, I am Dong, I'm from Viet Nam. I am studying for CHARM to Mining Closed Item. can You send to me source of CHARM? Thank you very so much.