-
dotenv-java 2.1.0 API
+dotenv-java 2.2.0 API
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.Filter.html b/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.Filter.html
index 0f1a72a..4925733 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.Filter.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.Filter.html
@@ -2,10 +2,10 @@
-
-Dotenv.Filter (dotenv-java 2.1.0 API)
+
+Dotenv.Filter (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.html b/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.html
index 062eefb..365e387 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/Dotenv.html
@@ -2,10 +2,10 @@
-
-Dotenv (dotenv-java 2.1.0 API)
+
+Dotenv (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/DotenvBuilder.html b/docs/javadoc/io/github/cdimascio/dotenv/DotenvBuilder.html
index 2573421..3faceee 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/DotenvBuilder.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/DotenvBuilder.html
@@ -2,10 +2,10 @@
-
-DotenvBuilder (dotenv-java 2.1.0 API)
+
+DotenvBuilder (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/DotenvEntry.html b/docs/javadoc/io/github/cdimascio/dotenv/DotenvEntry.html
index 5c712ef..681beb2 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/DotenvEntry.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/DotenvEntry.html
@@ -2,10 +2,10 @@
-
-DotenvEntry (dotenv-java 2.1.0 API)
+
+DotenvEntry (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/DotenvException.html b/docs/javadoc/io/github/cdimascio/dotenv/DotenvException.html
index f0ab61a..f5d5d8c 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/DotenvException.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/DotenvException.html
@@ -2,10 +2,10 @@
-
-DotenvException (dotenv-java 2.1.0 API)
+
+DotenvException (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.Filter.html b/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.Filter.html
index b0c5c8e..0000b6b 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.Filter.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.Filter.html
@@ -2,10 +2,10 @@
-
-Uses of Class io.github.cdimascio.dotenv.Dotenv.Filter (dotenv-java 2.1.0 API)
+
+Uses of Class io.github.cdimascio.dotenv.Dotenv.Filter (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.html b/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.html
index 02cea72..a492b83 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/class-use/Dotenv.html
@@ -2,10 +2,10 @@
-
-Uses of Interface io.github.cdimascio.dotenv.Dotenv (dotenv-java 2.1.0 API)
+
+Uses of Interface io.github.cdimascio.dotenv.Dotenv (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvBuilder.html b/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvBuilder.html
index c74cfcd..cb5550f 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvBuilder.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvBuilder.html
@@ -2,10 +2,10 @@
-
-Uses of Class io.github.cdimascio.dotenv.DotenvBuilder (dotenv-java 2.1.0 API)
+
+Uses of Class io.github.cdimascio.dotenv.DotenvBuilder (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvEntry.html b/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvEntry.html
index f497da5..9755f00 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvEntry.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvEntry.html
@@ -2,10 +2,10 @@
-
-Uses of Class io.github.cdimascio.dotenv.DotenvEntry (dotenv-java 2.1.0 API)
+
+Uses of Class io.github.cdimascio.dotenv.DotenvEntry (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvException.html b/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvException.html
index 366d103..fff5417 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvException.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/class-use/DotenvException.html
@@ -2,10 +2,10 @@
-
-Uses of Class io.github.cdimascio.dotenv.DotenvException (dotenv-java 2.1.0 API)
+
+Uses of Class io.github.cdimascio.dotenv.DotenvException (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/ClasspathHelper.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/ClasspathHelper.html
index 8d7c967..437ab0d 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/ClasspathHelper.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/ClasspathHelper.html
@@ -2,10 +2,10 @@
-
-ClasspathHelper (dotenv-java 2.1.0 API)
+
+ClasspathHelper (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvParser.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvParser.html
index b436302..f5ca297 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvParser.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvParser.html
@@ -2,10 +2,10 @@
-
-DotenvParser (dotenv-java 2.1.0 API)
+
+DotenvParser (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvReader.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvReader.html
index 71a6251..559f454 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvReader.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/DotenvReader.html
@@ -2,10 +2,10 @@
-
-DotenvReader (dotenv-java 2.1.0 API)
+
+DotenvReader (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/ClasspathHelper.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/ClasspathHelper.html
index 5c0b05c..90a32f8 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/ClasspathHelper.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/ClasspathHelper.html
@@ -2,10 +2,10 @@
-
-Uses of Class io.github.cdimascio.dotenv.internal.ClasspathHelper (dotenv-java 2.1.0 API)
+
+Uses of Class io.github.cdimascio.dotenv.internal.ClasspathHelper (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvParser.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvParser.html
index c30f954..4c352a2 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvParser.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvParser.html
@@ -2,10 +2,10 @@
-
-Uses of Class io.github.cdimascio.dotenv.internal.DotenvParser (dotenv-java 2.1.0 API)
+
+Uses of Class io.github.cdimascio.dotenv.internal.DotenvParser (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvReader.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvReader.html
index 5fba7a9..0bcf584 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvReader.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/class-use/DotenvReader.html
@@ -2,10 +2,10 @@
-
-Uses of Class io.github.cdimascio.dotenv.internal.DotenvReader (dotenv-java 2.1.0 API)
+
+Uses of Class io.github.cdimascio.dotenv.internal.DotenvReader (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/package-summary.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/package-summary.html
index 6d77221..6654633 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/package-summary.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/package-summary.html
@@ -2,10 +2,10 @@
-
-io.github.cdimascio.dotenv.internal (dotenv-java 2.1.0 API)
+
+io.github.cdimascio.dotenv.internal (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/package-tree.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/package-tree.html
index d7f4e30..8ead139 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/package-tree.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/package-tree.html
@@ -2,10 +2,10 @@
-
-io.github.cdimascio.dotenv.internal Class Hierarchy (dotenv-java 2.1.0 API)
+
+io.github.cdimascio.dotenv.internal Class Hierarchy (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/internal/package-use.html b/docs/javadoc/io/github/cdimascio/dotenv/internal/package-use.html
index b0fbb9f..a6ee118 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/internal/package-use.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/internal/package-use.html
@@ -2,10 +2,10 @@
-
-Uses of Package io.github.cdimascio.dotenv.internal (dotenv-java 2.1.0 API)
+
+Uses of Package io.github.cdimascio.dotenv.internal (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/package-summary.html b/docs/javadoc/io/github/cdimascio/dotenv/package-summary.html
index 243e76d..1e10d14 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/package-summary.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/package-summary.html
@@ -2,10 +2,10 @@
-
-io.github.cdimascio.dotenv (dotenv-java 2.1.0 API)
+
+io.github.cdimascio.dotenv (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/package-tree.html b/docs/javadoc/io/github/cdimascio/dotenv/package-tree.html
index bc45b57..16b33e1 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/package-tree.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/package-tree.html
@@ -2,10 +2,10 @@
-
-io.github.cdimascio.dotenv Class Hierarchy (dotenv-java 2.1.0 API)
+
+io.github.cdimascio.dotenv Class Hierarchy (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/io/github/cdimascio/dotenv/package-use.html b/docs/javadoc/io/github/cdimascio/dotenv/package-use.html
index 1c5e7e2..acf7df2 100644
--- a/docs/javadoc/io/github/cdimascio/dotenv/package-use.html
+++ b/docs/javadoc/io/github/cdimascio/dotenv/package-use.html
@@ -2,10 +2,10 @@
-
-Uses of Package io.github.cdimascio.dotenv (dotenv-java 2.1.0 API)
+
+Uses of Package io.github.cdimascio.dotenv (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/overview-summary.html b/docs/javadoc/overview-summary.html
index fd1fbbd..364c19a 100644
--- a/docs/javadoc/overview-summary.html
+++ b/docs/javadoc/overview-summary.html
@@ -2,10 +2,10 @@
-
-dotenv-java 2.1.0 API
+
+dotenv-java 2.2.0 API
-
+
diff --git a/docs/javadoc/overview-tree.html b/docs/javadoc/overview-tree.html
index 18148f1..11dac2f 100644
--- a/docs/javadoc/overview-tree.html
+++ b/docs/javadoc/overview-tree.html
@@ -2,10 +2,10 @@
-
-Class Hierarchy (dotenv-java 2.1.0 API)
+
+Class Hierarchy (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/serialized-form.html b/docs/javadoc/serialized-form.html
index 57f2f2d..1758855 100644
--- a/docs/javadoc/serialized-form.html
+++ b/docs/javadoc/serialized-form.html
@@ -2,10 +2,10 @@
-
-Serialized Form (dotenv-java 2.1.0 API)
+
+Serialized Form (dotenv-java 2.2.0 API)
-
+
diff --git a/docs/javadoc/system-properties.html b/docs/javadoc/system-properties.html
index 7e140cc..6b268e2 100644
--- a/docs/javadoc/system-properties.html
+++ b/docs/javadoc/system-properties.html
@@ -2,10 +2,10 @@
-
-System Properties (dotenv-java 2.1.0 API)
+
+System Properties (dotenv-java 2.2.0 API)
-
+
diff --git a/pom.xml b/pom.xml
index 41be6cc..9ea5f3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
io.github.cdimascio
dotenv-java
- 2.1.0
+ 2.2.0
diff --git a/src/main/java/io/github/cdimascio/dotenv/DotenvBuilder.java b/src/main/java/io/github/cdimascio/dotenv/DotenvBuilder.java
index d25cf40..4361165 100644
--- a/src/main/java/io/github/cdimascio/dotenv/DotenvBuilder.java
+++ b/src/main/java/io/github/cdimascio/dotenv/DotenvBuilder.java
@@ -3,13 +3,9 @@
import io.github.cdimascio.dotenv.internal.DotenvParser;
import io.github.cdimascio.dotenv.internal.DotenvReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
-import static java.util.stream.Collectors.toMap;
-import static java.util.stream.Collectors.toUnmodifiableSet;
+import static java.util.stream.Collectors.*;
/**
* Builds and loads and {@link Dotenv} instance
@@ -97,11 +93,11 @@ public DotenvImpl(List envVars) {
this.set =this.envVars.entrySet().stream()
.map(it -> new DotenvEntry(it.getKey(), it.getValue()))
- .collect(toUnmodifiableSet());
+ .collect(collectingAndThen(toSet(), Collections::unmodifiableSet));
this.setInFile =this.envVarsInFile.entrySet().stream()
.map(it -> new DotenvEntry(it.getKey(), it.getValue()))
- .collect(toUnmodifiableSet());
+ .collect(collectingAndThen(toSet(), Collections::unmodifiableSet));
}
@Override
diff --git a/src/main/java/io/github/cdimascio/dotenv/internal/DotenvParser.java b/src/main/java/io/github/cdimascio/dotenv/internal/DotenvParser.java
index ce858d6..deba6d3 100644
--- a/src/main/java/io/github/cdimascio/dotenv/internal/DotenvParser.java
+++ b/src/main/java/io/github/cdimascio/dotenv/internal/DotenvParser.java
@@ -5,11 +5,14 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static java.util.Collections.emptyList;
+
public class DotenvParser {
private final DotenvReader reader;
private final boolean throwIfMissing;
@@ -30,7 +33,7 @@ public List parse() throws DotenvException {
List entries = new ArrayList<>();
for (String line : lines()) {
String l = line.trim();
- if (isWhiteSpace.apply(l) || isComment.apply(l) || l.isBlank()) continue;
+ if (isWhiteSpace.apply(l) || isComment.apply(l) || isBlank(l)) continue;
DotenvEntry entry = parseLine.apply(l);
if (entry == null) {
@@ -49,7 +52,7 @@ private List lines() throws DotenvException {
return reader.read();
} catch (DotenvException e) {
if (throwIfMissing) throw e;
- return List.of();
+ return emptyList();
} catch (IOException e) {
throw new DotenvException(e);
}
@@ -75,4 +78,8 @@ private static DotenvEntry matchEntry(String regex, String text) {
if (!result || matcher.groupCount() < 3) return null;
return new DotenvEntry(matcher.group(1), matcher.group(3));
}
+
+ private boolean isBlank(String s) {
+ return s == null || s.trim().isEmpty();
+ }
}