Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Any API in java to generate a sequence?  RSS feed

 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am looking to generate a sequence in Java similar to the Database sequences we have.
Is there any API available to do this ?
Googling didnt give me any fruitful result.

Any help in this regard will be appreciated

Thanks,
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
probably too trivial to be a part of any ready made library, though maybe Jakarta commons may have something along the lines.

easiest:
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool,
Thanks, although it looks like we donot have any core API for this.
no probs, i think writing own counters would do the job.

Thanks for thr quick reply
 
osman cinar eren
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

with java 5.0 we have the classes in java.util.concurrent.atomic; for example you can use the "public final int getAndIncrement()" of AtomicInteger class.

hope this helps..
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by osman cinar eren:
Hi,

with java 5.0 we have the classes in java.util.concurrent.atomic; for example you can use the "public final int getAndIncrement()" of AtomicInteger class.

hope this helps..


Thanks a lot. this was perfectly what i was looking for.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!