@ Nonnull public static < I > Word < I > fromArray ( I [ ] symbols , int offset , int length ) { if ( length == 0 ) { return epsilon ( ) ; } if ( length == 1 ) { return fromLetter ( symbols [ offset ] ) ; } Object [ ] array = new Object [ length ] ; System . arraycopy ( symbols , offset , array , 0 , length ) ; return new SharedWord <> ( array ) ; }
Creates a word from a subrange of an array of symbols . Note that to ensure immutability internally a copy of the array is made .