public static < T , P , A > Collection < A > collectWith ( Iterable < T > iterable , Function2 < ? super T , ? super P , ? extends A > function , P parameter ) { if ( iterable instanceof MutableCollection ) { return ( ( MutableCollection < T > ) iterable ) . collectWith ( function , parameter ) ; } if ( iterable instanceof ArrayList ) { return ArrayListIterate . collectWith ( ( ArrayList < T > ) iterable , function , parameter ) ; } if ( iterable instanceof List < ? > ) { return ListIterate . collectWith ( ( List < T > ) iterable , function , parameter ) ; } if ( iterable instanceof Collection ) { return IterableIterate . collectWith ( iterable , function , parameter , DefaultSpeciesNewStrategy . INSTANCE . < A > speciesNew ( ( Collection < T > ) iterable , ( ( Collection < T > ) iterable ) . size ( ) ) ) ; } if ( iterable != null ) { return IterableIterate . collectWith ( iterable , function , parameter ) ; } throw new IllegalArgumentException ( "Cannot perform a collectWith on null" ) ; }
Same as collect with a Function2 and specified parameter which is passed to the function .