Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

casting a Arraylist

Posted on 2011-09-19
5
Medium Priority
?
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 300 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:Gurvinder Pal Singh
Gurvinder Pal Singh earned 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

705 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