Solved

casting a Arraylist

Posted on 2011-09-19
5
303 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Checkbox and ListView in Android Layout 4 65
servlet example 17 29
null output 3 24
String array comparison 4 32
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

786 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