Solved

casting a Arraylist

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Securing Jmx Console and web console 2 66
github account with ecipse 1 42
expectj telnet failing 5 26
hibernate example for saving data 19 14
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
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 …

863 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

23 Experts available now in Live!

Get 1:1 Help Now