Skip to content

Commit

Permalink
Day090
Browse files Browse the repository at this point in the history
  • Loading branch information
hbelmiro committed Aug 17, 2021
1 parent b169093 commit 78bc1a2
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3449,4 +3449,34 @@ class MethodValidator {
}
}
}
----

== Day 90 - Using `StringJoiner`.
[source,java]
----
package com.thegreatapi.ahundreddaysofjava.day090;
import java.util.StringJoiner;
public class Day090 {
public static void main(String[] args) {
var stringJoiner = new StringJoiner(";");
stringJoiner.add("this");
stringJoiner.add("is");
stringJoiner.add("a");
stringJoiner.add("StringJoiner");
stringJoiner.add("and")
.add("it")
.add("has")
.add("a")
.add("fluent")
.add("api");
// Prints: this;is;a;StringJoiner;and;it;has;a;fluent;api
System.out.println(stringJoiner);
}
}
----
19 changes: 19 additions & 0 deletions days/day090/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>days</artifactId>
<groupId>com.thegreatapi.100daysofjava</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>day090</artifactId>

<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.thegreatapi.ahundreddaysofjava.day090;

import java.util.StringJoiner;

public class Day090 {

public static void main(String[] args) {
var stringJoiner = new StringJoiner(";");

stringJoiner.add("this");
stringJoiner.add("is");
stringJoiner.add("a");
stringJoiner.add("StringJoiner");

stringJoiner.add("and")
.add("it")
.add("has")
.add("a")
.add("fluent")
.add("api");

// Prints: this;is;a;StringJoiner;and;it;has;a;fluent;api
System.out.println(stringJoiner);
}
}
1 change: 1 addition & 0 deletions days/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<module>day087</module>
<module>day088</module>
<module>day089</module>
<module>day090</module>
</modules>

</project>

0 comments on commit 78bc1a2

Please sign in to comment.