Skip to content

Commit 862a5e7

Browse files
committed
feat: simplify structure chain using Stream api
Signed-off-by: Otavio Santana <[email protected]>
1 parent 7702592 commit 862a5e7

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

cassandra/src/main/java/org/jnosql/demo/se/App3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static void main(String[] args) {
3939
System.out.println("Person saved" + saved);
4040

4141

42-
List<Person> people = cassandraTemplate.<Person>cql("select * from developers.Person where id = 1").collect(Collectors.toList());
42+
List<Person> people = cassandraTemplate.<Person>cql("select * from developers.Person where id = 1").toList();
4343
System.out.println("Entity found: " + people);
4444

4545
}

janus-graph/src/main/java/org/jnosql/demo/se/BookApp.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ public static void main(String[] args) {
6161
.has("name", "Software")
6262
.in("is").hasLabel("Category").<Category>result()
6363
.map(Category::getName)
64-
.collect(toList());
64+
.toList();
6565

6666
List<String> softwareBooks = graph.traversalVertex().hasLabel("Category")
6767
.has("name", "Software")
6868
.in("is").hasLabel("Book").<Book>result()
6969
.map(Book::getName)
70-
.collect(toList());
70+
.toList();
7171

7272
List<String> sofwareNoSQLBooks = graph.traversalVertex().hasLabel("Category")
7373
.has("name", "Software")
7474
.in("is")
7575
.has("name", "NoSQL")
7676
.in("is").<Book>result()
7777
.map(Book::getName)
78-
.collect(toList());
78+
.toList();
7979

8080

8181
System.out.println("The software categories: " + softwareCategories);

janus-graph/src/main/java/org/jnosql/demo/se/MarketingApp.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ public static void main(String[] args) {
5757
.has("salary", gte(3_000D))
5858
.has("age", between(20, 25))
5959
.has("occupation", "Developer")
60-
.<Person>result().collect(toList());
60+
.<Person>result().toList();
6161

6262
List<Person> peopleWhoDeveloperKnows = template.traversalVertex()
6363
.has("salary", gte(3_000D))
6464
.has("age", between(20, 25))
6565
.has("occupation", "Developer")
6666
.out("knows")
67-
.<Person>result().collect(toList());
67+
.<Person>result().toList();
6868

6969
List<Person> both = template.traversalVertex()
7070
.has("salary", gte(3_000D))
@@ -74,7 +74,7 @@ public static void main(String[] args) {
7474
.bothV()
7575
.<Person>result()
7676
.distinct()
77-
.collect(toList());
77+
.toList();
7878

7979
List<Person> couple = template.traversalVertex()
8080
.has("salary", gte(3_000D))
@@ -85,7 +85,7 @@ public static void main(String[] args) {
8585
.bothV()
8686
.<Person>result()
8787
.distinct()
88-
.collect(toList());
88+
.toList();
8989

9090
System.out.println("Developers has salary greater than 3000 and age between 20 and 25: " + developers);
9191
System.out.println("Person who the Developers target know: " + peopleWhoDeveloperKnows);

janus-graph/src/main/java/org/jnosql/demo/se/TravelApp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public static void main(String[] args) {
114114
List<String> friendsCasaBlanca = graph.traversalVertex()
115115
.hasLabel("City")
116116
.has("name", "Casa Blanca")
117-
.in(TRAVELS).<Traveler>result().map(Traveler::getName).collect(toList());
117+
.in(TRAVELS).<Traveler>result().map(Traveler::getName).toList();
118118

119119
System.out.println("The city most fun: "+ mostFunCity);
120120
System.out.println("The city most business: "+ mostBusiness);

mongodb-double/src/main/java/org/jnosql/demo/se/App.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public static void main(String[] args) {
3434
greek.insert(artemis);
3535

3636
LOGGER.info("Finding in the Greek service ");
37-
LOGGER.info("Finding by Artemis : " + greek.findName("Artemis").collect(Collectors.toList()));
38-
LOGGER.info("Finding by Diana " + greek.findName("Diana").collect(Collectors.toList()));
37+
LOGGER.info("Finding by Artemis : " + greek.findName("Artemis").toList());
38+
LOGGER.info("Finding by Diana " + greek.findName("Diana").toList());
3939

4040
LOGGER.info("Finding in the Roman service ");
41-
LOGGER.info("Finding by Artemis : " + romain.findName("Artemis").collect(Collectors.toList()));
42-
LOGGER.info("Finding by Diana " + romain.findName("Diana").collect(Collectors.toList()));
41+
LOGGER.info("Finding by Artemis : " + romain.findName("Artemis").toList());
42+
LOGGER.info("Finding by Diana " + romain.findName("Diana").toList());
4343

4444
}
4545
}

neo4j/src/main/java/org/jnosql/demo/se/BookApp.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,21 @@ public static void main(String[] args) {
7979
.has("name", "Software")
8080
.in("is").hasLabel("Category").<Category>result()
8181
.map(Category::getName)
82-
.collect(toList());
82+
.toList();
8383

8484
List<String> softwareBooks = graph.traversalVertex().hasLabel("Category")
8585
.has("name", "Software")
8686
.in("is").hasLabel("Book").<Book>result()
8787
.map(Book::getName)
88-
.collect(toList());
88+
.toList();
8989

9090
List<String> sofwareNoSQLBooks = graph.traversalVertex().hasLabel("Category")
9191
.has("name", "Software")
9292
.in("is")
9393
.has("name", "NoSQL")
9494
.in("is").<Book>result()
9595
.map(Book::getName)
96-
.collect(toList());
96+
.toList();
9797

9898

9999
System.out.println("The software categories: " + softwareCategories);

neo4j/src/main/java/org/jnosql/demo/se/MarketingApp.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ public static void main(String[] args) {
7070

7171
List<Person> developers = graph.traversalVertex()
7272
.has("occupation", "Developer")
73-
.<Person>result().collect(toList());
73+
.<Person>result().toList();
7474

7575
List<Person> peopleWhoDeveloperKnows = graph.traversalVertex()
7676
.has("salary", gte(3_000D))
7777
.has("age", between(20, 25))
7878
.has("occupation", "Developer")
7979
.out("knows")
80-
.<Person>result().collect(toList());
80+
.<Person>result().toList();
8181

8282
List<Person> both = graph.traversalVertex()
8383
.has("salary", gte(3_000D))
@@ -87,7 +87,7 @@ public static void main(String[] args) {
8787
.bothV()
8888
.<Person>result()
8989
.distinct()
90-
.collect(toList());
90+
.toList();
9191

9292
List<Person> couple = graph.traversalVertex()
9393
.has("salary", gte(3_000D))
@@ -98,7 +98,7 @@ public static void main(String[] args) {
9898
.bothV()
9999
.<Person>result()
100100
.distinct()
101-
.collect(toList());
101+
.toList();
102102

103103
System.out.println("Developers has salary greater than 3000 and age between 20 and 25: " + developers);
104104
System.out.println("Person who the Developers target know: " + peopleWhoDeveloperKnows);

scylla/src/main/java/org/jnosql/demo/se/App3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static void main(String[] args) {
3232
Person saved = cassandraTemplate.save(person, ConsistencyLevel.ONE);
3333
System.out.println("Person saved" + saved);
3434
List<Person> people = cassandraTemplate.<Person>cql("select * from developers.Person where id = 1")
35-
.collect(Collectors.toList());
35+
.toList();
3636
System.out.println("Entity found: " + people);
3737

3838
}

0 commit comments

Comments
 (0)