Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert ArrayList to List  RSS feed

 
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
Sheriff
Posts: 23260
124
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
Marshal
Posts: 54876
155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!