aboutsummaryrefslogtreecommitdiffstats
path: root/testbench-api
diff options
context:
space:
mode:
Diffstat (limited to 'testbench-api')
-rw-r--r--testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java48
1 files changed, 21 insertions, 27 deletions
diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java
index a7253b7229..79b84780ac 100644
--- a/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java
+++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java
@@ -496,35 +496,29 @@ public class GridElement extends AbstractComponentElement {
* @return an iterable of all the data rows in the grid.
*/
public Iterable<GridRowElement> getRows() {
- return new Iterable<GridElement.GridRowElement>() {
+ return () -> new Iterator<GridElement.GridRowElement>() {
+ int nextIndex = 0;
+
+ @Override
+ public GridRowElement next() {
+ return getRow(nextIndex++);
+ }
+
@Override
- public Iterator<GridRowElement> iterator() {
- return new Iterator<GridElement.GridRowElement>() {
- int nextIndex = 0;
-
- @Override
- public GridRowElement next() {
- return getRow(nextIndex++);
- }
-
- @Override
- public boolean hasNext() {
- try {
- getRow(nextIndex);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException(
- "remove not supported");
- }
-
- };
+ public boolean hasNext() {
+ try {
+ getRow(nextIndex);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
}
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("remove not supported");
+ }
+
};
}
}