List of usage examples for java.util.stream IntStream forEach
void forEach(IntConsumer action);
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.of(1); i.forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.of(1, 2, 3, 4, 5, 6, 7); IntStream o = i.sequential(); o.forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 3); IntStream d = i.map(n -> -n); d.forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.concat(IntStream.of(6, 5, 7, 1, 2, 3, 3), IntStream.of(9, 8)); IntStream d = i.map(n -> -n); d.forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.range(1, 7); i.forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.rangeClosed(1, 7); i.forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.builder().add(0).build(); i.forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 3); IntStream i2 = i.flatMap(n -> IntStream.of(n * n)); i2.forEach(System.out::println); }
From source file:org.kie.workbench.common.forms.migration.tool.pipelines.basic.AbstractFormDefinitionGeneratorTest.java
protected void verifyInvoiceForm(FormMigrationSummary summary) { Form originalForm = summary.getOriginalForm().get(); Assertions.assertThat(originalForm.getFormFields()).isNotEmpty().hasSize(3); FormDefinition newForm = summary.getNewForm().get(); Assertions.assertThat(newForm.getFields()).isNotEmpty().hasSize(3); Assertions.assertThat(newForm.getModel()).isNotNull() .hasFieldOrPropertyWithValue("className", INVOICE_MODEL).isInstanceOf(DataObjectFormModel.class); IntStream indexStream = IntStream.range(0, newForm.getFields().size()); LayoutTemplate formLayout = newForm.getLayoutTemplate(); assertNotNull(formLayout);/* ww w . java2s. co m*/ Assertions.assertThat(formLayout.getRows()).isNotEmpty().hasSize(newForm.getFields().size()); indexStream.forEach(index -> { FieldDefinition fieldDefinition = newForm.getFields().get(index); switch (index) { case 0: checkFieldDefinition(fieldDefinition, INVOICE_USER, "user (invoice)", "user", SubFormFieldDefinition.class, newForm, originalForm.getField(fieldDefinition.getName())); break; case 1: checkFieldDefinition(fieldDefinition, INVOICE_LINES, "lines (invoice)", "lines", MultipleSubFormFieldDefinition.class, newForm, originalForm.getField(fieldDefinition.getName())); break; case 3: checkFieldDefinition(fieldDefinition, INVOICE_LINES, "lines (invoice)", "lines", MultipleSubFormFieldDefinition.class, newForm, originalForm.getField(fieldDefinition.getName())); break; } LayoutRow fieldRow = formLayout.getRows().get(index); assertNotNull(fieldRow); Assertions.assertThat(fieldRow.getLayoutColumns()).isNotEmpty().hasSize(1); LayoutColumn fieldColumn = fieldRow.getLayoutColumns().get(0); assertNotNull(fieldColumn); assertEquals("12", fieldColumn.getSpan()); Assertions.assertThat(fieldColumn.getLayoutComponents()).isNotEmpty().hasSize(1); checkLayoutFormField(fieldColumn.getLayoutComponents().get(0), fieldDefinition, newForm); }); }
From source file:org.kie.workbench.common.forms.migration.tool.pipelines.basic.AbstractFormDefinitionGeneratorTest.java
protected void verifyUserForm(FormMigrationSummary summary) { Form originalForm = summary.getOriginalForm().get(); Assertions.assertThat(originalForm.getFormFields()).isNotEmpty().hasSize(2); FormDefinition newForm = summary.getNewForm().get(); Assertions.assertThat(newForm.getFields()).isNotEmpty().hasSize(2); Assertions.assertThat(newForm.getModel()).isNotNull().hasFieldOrPropertyWithValue("className", USER_MODEL) .isInstanceOf(DataObjectFormModel.class); IntStream indexStream = IntStream.range(0, newForm.getFields().size()); LayoutTemplate formLayout = newForm.getLayoutTemplate(); assertNotNull(formLayout);/*w w w . jav a 2 s . co m*/ Assertions.assertThat(formLayout.getRows()).isNotEmpty().hasSize(2); indexStream.forEach(index -> { FieldDefinition fieldDefinition = newForm.getFields().get(index); switch (index) { case 0: checkFieldDefinition(fieldDefinition, USER_LOGIN, "login", "login", TextBoxFieldDefinition.class, newForm, originalForm.getField(fieldDefinition.getName())); break; case 1: checkFieldDefinition(fieldDefinition, USER_PASSWORD, "password", "password", TextBoxFieldDefinition.class, newForm, originalForm.getField(fieldDefinition.getName())); break; } LayoutRow fieldRow = formLayout.getRows().get(index); assertNotNull(fieldRow); Assertions.assertThat(fieldRow.getLayoutColumns()).isNotEmpty().hasSize(1); LayoutColumn fieldColumn = fieldRow.getLayoutColumns().get(0); assertNotNull(fieldColumn); assertEquals("12", fieldColumn.getSpan()); Assertions.assertThat(fieldColumn.getLayoutComponents()).isNotEmpty().hasSize(1); checkLayoutFormField(fieldColumn.getLayoutComponents().get(0), fieldDefinition, newForm); }); }