ConcatSequencer implements ElementSequencer<T> { @Override public int[] seqIndexesByRatios(List<T> elems, List<Long> ratios) { List<Integer> sequence = new ArrayList<>(); for (int elemIndex = 0; elemIndex < elems.size(); elemIndex++) { long runLength = ratios.get(elemIndex); for (int i = 0; i< runLength; i++) { sequence.add(elemIndex); } } return sequence.stream().mapToInt(i -> (int)i).toArray(); }  @Override int[] seqIndexByRatioFunc(List<T> elems, ToLongFunction<T> ratioFunc); @Override int[] seqIndexesByRatios(List<T> elems, List<Long> ratios);  }
@Test public void testSeqIndexesByRatios() throws Exception { ConcatSequencer<String> concat = new ConcatSequencer<>(); int[] ints = concat.seqIndexesByRatios(strings(a,b), ratios(2, 5)); assertThat(ints).containsExactly(0,0,1,1,1,1,1); }