|
-
April 28th, 2008, 07:52 PM
#1
generic, stuck
I have problem in the following code:
It is a code to parse a tree node with any number of childs
Code:
// generate a collection to hold the children
Collection<TreeNode<String>> children = new ArrayList<TreeNode<String>>();
while (has more child){
children.add(parse the child...);
}
createNode(...);
Now there is a problem, createNode takes an array if TreeNode<String> instead of collection.
Now I am stuck between array and collection
toArray returns Object[] which i cannot cast to TreeNode<String>[]
I also cannot create a new TreeNode<String> array and copy the values into the array (ie: TreeNode<String>[] nodes = new TreeNode<String>[size]; does not work)
What can I do here?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|