## groovy.util
Class PermutationGenerator<E>

    java.lang.Object
      groovy.util.PermutationGenerator<E>

All Implemented Interfaces:
  Iterator<List<E>>

    public class PermutationGenerator<E>

extends Object
implements Iterator<List<E>>

Constructor Summary
`PermutationGenerator(Collection<E> items)` WARNING: Don't make n too large.

Method Summary
`BigInteger` `getTotal()`
`boolean` `hasNext()`
`List<E>` `next()` Generate next permutation (algorithm from Rosen p. 284)
`void` `remove()`
`void` `reset()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PermutationGenerator

    public PermutationGenerator(Collection<E> items)

  WARNING: Don't make n too large. Recall that the number of permutations is n! which can be very large, even when n is as small as 20 -- 20! = 2,432,902,008,176,640,000 and 21! is too big to fit into a Java long, which is why we use BigInteger instead.

  Parameters:
    `items` - the items to permute

Method Detail

### reset

    public void reset()

### getTotal

    public BigInteger getTotal()

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `Iterator<List<E>>`

### next

    public List<E> next()

  Generate next permutation (algorithm from Rosen p. 284)

  Specified by:
    `next` in interface `Iterator<List<E>>`
  Returns:
    the items permuted

### remove

    public void remove()

  Specified by:
    `remove` in interface `Iterator<List<E>>`

Copyright © 2003-2009 The Codehaus. All rights reserved.