casting a Arraylist

I am calling a ArrayList from a different class.  Once I get the ArrayList in this class, I want to cast it to a TCComponentItemRevision

Here is the constructor
 public SelectedTModel() {
     ArrayList<RevDataset> aList = EdiSelection.rds;

Open in new window

Then I am using the ArrayList in a method
 public void getListValues(int row, int column, ArrayList <RevDataset> aList) throws TCException {

Open in new window

But I need to cast the ArrayList to  TCComponentItemRevision
Who is Participating?
for_yanConnect With a Mentor Commented:
Waht you meant by casting ArryList?

You iterate through ArrayList and retrieve its ellemnts of type RevDataset
and then get from these elements using their get methods each of their compounents which are TCCiomponent isf I rememeber correctly
Waht type expects your method in that third position ?
Gurvinder Pal SinghConnect With a Mentor Commented:
you can only cast it to TCComponentItemRevision if ArrayList is extending that class or implementation, otherwise you need to loop through the list elements and then convert it one by one
Theis method probably expects only one elemnt of your ArrayList and even maybe one part of it,
as the elements are the objects whiach are made up of two fileds, if I am not mistaken.

Show what is within that method  and we'll try to figure out
jkteaterAuthor Commented:
I went back to where I was creating the ArrayList and cast it there - So I am going to split the points - thanks for the quick response
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.