Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Any API in java to generate a sequence?  RSS feed

 
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,
 
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
 
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.
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!