public static < TSource , TResult > List < TResult > map ( Collection < TSource > items , Mapper < TSource , TResult > mapper ) { if ( isEmpty ( items ) ) { return new ArrayList <> ( ) ; } List < TResult > result = new ArrayList <> ( items . size ( ) ) ; for ( TSource item : items ) { TResult mappedItem = mapper . map ( item ) ; result . add ( mappedItem ) ; } return result ; }
Projects each element of a collection into a new collection .