java - ArrayList of Array which contains TreeNode -


i want create arraylist of array consist of treenodes. trial was

arraylist<arrays<treenode>> alist = new arraylist<arrays<treenode>>(); arrays<treenode> anodes = new arraylist<treenode>(); 

but gives error. (utils included)

what right way of writing this? aim find minimum depth of node in binary tree(just find minimum not find node itself, ll put levels arraylist, once size not 2^j, min level j-1).

thanks in advance, help/hint/solutions...

the arrays class util class, not type you'd use array. arrays class never takes generic argument, error telling you.

if want arraylist contains arrays, you're looking this:

arraylist<treenode[]> alist = new arraylist<>(); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -