Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

swap()

 
shree vijay
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there any equivalent to swap(i,j) in Java?
Thanks,
Shree
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shree,
To swap values within a function, use single-element arrays. See example below:


Hope this helps.
Stephanie
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shree,
To swap values within a function, use single-element arrays. See example below:


Hope this helps.
Stephanie
 
shree vijay
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stephanie,
I was curious to know if there was any method equivalent for swap... Just plain lasy ...
Shree
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic