ArrayUtils

fm.common.ArrayUtils$
object ArrayUtils

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

def permutations[T : ClassTag](values: Iterable[Iterable[T]]): IndexedSeq[IndexedSeq[T]]
def permutations[T : ClassTag](values: Array[Array[T]]): Array[Array[T]]

Return all permutations of values of an array of arrays

Return all permutations of values of an array of arrays

e.g.: scala> permutations(Array(Array(1,2,3), Array(1,2,3), Array(1,2))).map{ _.mkString(",") }.foreach{println} 1,1,1 1,1,2 1,2,1 1,2,2 1,3,1 1,3,2 2,1,1 2,1,2 2,2,1 2,2,2 2,3,1 2,3,2 3,1,1 3,1,2 3,2,1 3,2,2 3,3,1 3,3,2

Retain Ordering = false:

1,1,1 2,1,1 3,1,1 1,2,1 2,2,1 3,2,1 1,3,1 2,3,1 3,3,1 1,1,2 2,1,2 3,1,2 1,2,2 2,2,2 3,2,2 1,3,2 2,3,2 3,3,2

http://stackoverflow.com/questions/5751091/permutations-of-an-array-of-arrays-of-strings

Attributes

def shingles[T : ClassTag](parts: Array[T]): ImmutableArray[ImmutableArray[T]]
def shingles[T : ClassTag](parts: IndexedSeq[T]): ImmutableArray[ImmutableArray[T]]
def shingles[T : ClassTag](parts: IndexedSeq[T], minShingleSize: Int, maxShingleSize: Int, forceIncludeOriginal: Boolean): ImmutableArray[ImmutableArray[T]]