Skip to content

Commit 40d6af7

Browse files
authored
Refactor Ignite samples (eugenp#4010)
* asd * Update IgniteStream.java * Update IgniteStream.java * Update IgniteStream.java
1 parent 443a691 commit 40d6af7

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎libraries-data/src/main/java/com/baeldung/ignite/stream/IgniteStream.java‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
public class IgniteStream {
1616

17+
private static final Gson GSON = new Gson();
18+
1719
public static void main(String[] args) throws Exception {
1820

1921
Ignition.setClientMode(true);
@@ -29,16 +31,16 @@ public static void main(String[] args) throws Exception {
2931
employee.setEmployed(true);
3032
e.setValue(employee);
3133

32-
return null;
34+
return employee;
3335
}));
3436

3537
Path path = Paths.get(IgniteStream.class.getResource("employees.txt").toURI());
3638

3739
Files.lines(path)
38-
.forEach(line -> {
39-
Employee employee = new Gson().fromJson(line, Employee.class);
40-
streamer.addData(employee.getId(), employee);
41-
});
42-
43-
}
40+
.forEach(line -> {
41+
Employee employee = GSON.fromJson(line, Employee.class);
42+
streamer.addData(employee.getId(), employee);
43+
});
44+
}
45+
4446
}

0 commit comments

Comments
 (0)