• Post Reply Bookmark Topic Watch Topic
  • New Topic

Guys need help in casting

 
uzma ali
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am almost done with my finCriteria method but there is one question

Can we cast ArrayList to long[] provided the calues stored in the Arraylist are long too

I tried to assign directly the long values to long[]

long[] matchRecord = null;
matchRecord[1] = criteria // where criteria is long


It gives error so thought of sting the criteria values in ArrayList and convert it to long[]

Please help.

Thanks in Advance

Uzma
 
Michael Kelleher
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No - you cannot use auto-unboxing for this. You have to manually do the conversion. But, its a simple 5 line method to do this.
 
uzma ali
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply

But can you help a little more as I am trying to device a method since morning

thanks

Uzma
 
uzma ali
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it
uzma
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!