Package com.google.common.collect
Class Collections2.OrderedPermutationCollection<E>
- java.lang.Object
-
- java.util.AbstractCollection<java.util.List<E>>
-
- com.google.common.collect.Collections2.OrderedPermutationCollection<E>
-
- All Implemented Interfaces:
java.lang.Iterable<java.util.List<E>>,java.util.Collection<java.util.List<E>>
- Enclosing class:
- Collections2
private static final class Collections2.OrderedPermutationCollection<E> extends java.util.AbstractCollection<java.util.List<E>>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Comparator<? super E>comparator(package private) ImmutableList<E>inputList(package private) intsize
-
Constructor Summary
Constructors Constructor Description OrderedPermutationCollection(java.lang.Iterable<E> input, java.util.Comparator<? super E> comparator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <E> intcalculateSize(java.util.List<E> sortedInputList, java.util.Comparator<? super E> comparator)The number of permutations with repeated elements is calculated as follows: For an empty list, it is 1 (base case).booleancontains(java.lang.Object obj)booleanisEmpty()java.util.Iterator<java.util.List<E>>iterator()intsize()java.lang.StringtoString()-
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, containsAll, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
inputList
final ImmutableList<E> inputList
-
comparator
final java.util.Comparator<? super E> comparator
-
size
final int size
-
-
Method Detail
-
calculateSize
private static <E> int calculateSize(java.util.List<E> sortedInputList, java.util.Comparator<? super E> comparator)The number of permutations with repeated elements is calculated as follows:- For an empty list, it is 1 (base case).
- When r numbers are added to a list of n-r elements, the number of permutations is increased by a factor of (n choose r).
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<java.util.List<E>> iterator()
-
contains
public boolean contains(java.lang.Object obj)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.AbstractCollection<java.util.List<E>>
-
-