gw.lang.enhancements.CoreIterableOfIterablesEnhancement.gsx Maven / Gradle / Ivy
package gw.lang.enhancements
uses java.lang.Iterable
uses java.util.Iterator
/*
* Copyright 2014 Guidewire Software, Inc.
*/
enhancement CoreIterableOfIterablesEnhancement> : Iterable {
reified function flatten() : Iterable {
var outerIterable = this
return new Iterable() {
override function iterator() : Iterator {
return outerIterable.map(\ t -> t.iterator()).iterator().flatten()
}
}
}
}