This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert ArrayList to List

 
Anwarul Kabir
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have this arrayList and I need to return this as List<TransactionSummary>.

Is there any way I could load the data from arrayList to List<TransactionSummary>

my ArrayList which is called list is doing this

list.add(parseResultSetRow(rs));

The method parseResultSetRow() is returning TransactionSummary type.

Hope this makes sense.

BTW you probably can tell i am very new at this... so please hlp.
 
Henry Wong
author
Marshal
Pie
Posts: 20907
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An ArrayList IS-A List. There is no need to convert it. Just return the ArrayList as the List.

Henry
 
Campbell Ritchie
Sheriff
Posts: 48454
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic