SlimeStream { public static <T> Stream<T> fromArray(Inspector array, Function<Inspector, T> mapper) { return IntStream.range(0, array.entries()) .mapToObj(array::entry) .map(mapper); } private  SlimeStream(); static Stream<T> fromArray(Inspector array, Function<Inspector, T> mapper);  }
@Test public void test_empty_array() { var inspector = new Slime().setArray(); var items = SlimeStream.fromArray(inspector, Inspector::asString).collect(Collectors.toList()); assertEquals(List.of(), items); }
@Test public void test_some_elements() { var inspector = new Slime().setArray(); inspector.addString("foo"); inspector.addString("bar"); var items = SlimeStream.fromArray(inspector, Inspector::asString).collect(Collectors.toList()); assertEquals(List.of("foo", "bar"), items); }