aspose file tools*
The moose likes Java in General and the fly likes Permutations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Permutations" Watch "Permutations" New topic
Author

Permutations

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Does Java have a method that generates the permutations of a given List? I'm interested in something similar to next_permutation() from the C++ <algorithm> header.

Layne


Java API Documentation
The Java Tutorial
Yilmaz Mete
Greenhorn

Joined: Dec 23, 2003
Posts: 28
I don't think such a utility exists yet.
But should be simple to code.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
After some more research, I found some examples on the web. I know I could come up with it on my own if I want to, but I was hoping there was something already available. This is probably one of the few instances where I found the standard C++ library has functionality that is missing from the Java API.

Layne
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Permutations