Skip to content

Commit

Permalink
Smaller updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinFactory committed Jul 15, 2020
1 parent 895fd82 commit c5715a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ public Map<String, List<String>> assignCommentsToKey(final List<String> lines) {
String currentKey = FOOTER;
for (int i = lines.size() - 1; i >= 0; i--) {
final String line = lines.get(i);
if (line.trim().startsWith("#") || line.isEmpty()) {
if (!line.trim().startsWith("#") && !line.isEmpty()) {
currentKey = line;
} else {
final List<String> storage = out.get(currentKey.split(":")[0]);

if (storage == null) {
out.put(currentKey.split(":")[0],
out.put(
currentKey.split(":")[0],
new ArrayList<>(Collections.singletonList(line)));
} else {
storage.add(line);
}
} else {
currentKey = line;
}
}
return out;
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/de/leonhard/storage/util/FileUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package de.leonhard.storage.util;

import de.leonhard.storage.internal.provider.LightningProviders;
import lombok.Cleanup;
import lombok.NonNull;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import org.jetbrains.annotations.Nullable;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -12,10 +18,6 @@
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import lombok.Cleanup;
import lombok.NonNull;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;

/**
* Class for easier, more convenient & strait interaction with files
Expand All @@ -42,7 +44,7 @@ public List<File> listFiles(@NonNull final File folder) {
*/
public List<File> listFiles(
@NonNull final File folder,
@NonNull final String extension) {
@Nullable final String extension) {
final List<File> result = new ArrayList<>();

final File[] files = folder.listFiles();
Expand Down

0 comments on commit c5715a8

Please sign in to comment.