Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

DownCast or Upcast from type Node<E> to Object

Avatar of Dirk6996
Dirk6996 asked on
10 Comments1 Solution579 ViewsLast Modified:
In java I am trying to implement a new LinkList  class that implements the iterator interface so only using iterator. The problem is I want to cast whatever type the instance of the Node is like say of type <Integer>. In  my class the type that needs to be cast is not determined until the tester creates an LinkedList of a certain type with that certian Node type. I need some sort of downcast from type Object to whatever type is neded I have an instance field that is type <E> just need some downcast help.

//instance field
private Node <E> Item;
//initialazation of instance field in constructor
//Something like this I think
Item = (E) new Object<Node>;//I don't know how? please help thanks

Avatar of Mayank S
Mayank SFlag of India imagePrincipal Technologist

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answers