Solved

casting a Arraylist

Posted on 2011-09-19
5
301 Views
Last Modified: 2012-05-12
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() {
      super();
     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
0
Comment
Question by:jkteater
  • 3
5 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 75 total points
ID: 36561964
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
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36561974
Waht type expects your method in that third position ?
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 50 total points
ID: 36562000
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
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36562033
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
0
 

Author Comment

by:jkteater
ID: 36562082
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
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now