Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

Commit 4b14a53

Browse files
author
Jitendra Kotamraju
committed
Adding commented lambda usage of the api
1 parent 42d1372 commit 4b14a53

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

demos/twitter/pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<relativePath>../pom.xml</relativePath>
5252
</parent>
5353

54-
<packaging>pom</packaging>
54+
<packaging>jar</packaging>
5555
<url>http://maven.apache.org</url>
5656
<artifactId>jsondemos-twitter</artifactId>
5757

@@ -79,7 +79,6 @@
7979
<target>1.7</target>
8080
</configuration>
8181
</plugin>
82-
<!-- mvn exec:java
8382
<plugin>
8483
<groupId>org.codehaus.mojo</groupId>
8584
<artifactId>exec-maven-plugin</artifactId>
@@ -92,10 +91,9 @@
9291
</execution>
9392
</executions>
9493
<configuration>
95-
<mainClass>org.glassfish.jsondemos.twitter.TwitterStreamSearch</mainClass>
94+
<mainClass>org.glassfish.jsondemos.twitter.TwitterObjectSearch</mainClass>
9695
</configuration>
9796
</plugin>
98-
-->
9997
</plugins>
10098
</build>
10199
</project>

demos/twitter/src/main/java/org/glassfish/jsondemos/twitter/TwitterObjectSearch.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,17 @@ public static void main(String... args) throws Exception {
8585
System.out.println(result.get("text"));
8686
System.out.println("-----------");
8787
}
88+
89+
// All the tweets are collected into Stream<String> and printed
90+
// obj.getJsonArray("statuses").getValuesAs(JsonObject.class)
91+
// .stream()
92+
// .map(v -> v.getString("text"))
93+
// .forEach(s -> { System.out.println(s); } );
8894
}
8995
}
9096

9197
static InputStream getSearchStream() throws Exception {
92-
final String searchStr = "#telugu";
98+
final String searchStr = "#javaone";
9399
String searchUrl = "https://api.twitter.com/1.1/search/tweets.json";
94100

95101
Properties config = new Properties();

0 commit comments

Comments
 (0)