public static List < String > zip ( String ... inputs ) { if ( inputs . length == 0 ) { return Collections . emptyList ( ) ; } OptionalInt min = Arrays . stream ( inputs ) . mapToInt ( str -> str == null ? 0 : str . length ( ) ) . min ( ) ; if ( ! min . isPresent ( ) ) { return Collections . emptyList ( ) ; } return IntStream . range ( 0 , min . getAsInt ( ) ) . mapToObj ( elementIndex -> Arrays . stream ( inputs ) . map ( input -> String . valueOf ( input . charAt ( elementIndex ) ) ) . collect ( joining ( ) ) ) . collect ( toList ( ) ) ; }
Aggregates the contents of n strings into a single list of tuples .