From 44ed9fbcc7e8f1e1b87ce7620cd9e5a83ece9d3d Mon Sep 17 00:00:00 2001
From: Jasmin Lehtola <jajohl@utu.fi>
Date: Thu, 5 Oct 2023 10:11:55 +0000
Subject: [PATCH] Upload New File

---
 SiteGen.java | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 SiteGen.java

diff --git a/SiteGen.java b/SiteGen.java
new file mode 100644
index 0000000..9d777ae
--- /dev/null
+++ b/SiteGen.java
@@ -0,0 +1,27 @@
+import java.nio.file.*;
+import java.util.*;
+import java.util.stream.*;
+
+class SiteGen {
+    static String siteTitle = "My favorite movies";
+
+    static List<String> movieList = List.of(
+        "Star Wars",
+        "Star Trek",
+        "Battlestar Galactica"
+    );
+
+    static String htmlString =
+        "<html>" +
+            "<head><title>" + siteTitle + "</title></head>" +
+            "<body>" +
+                "<h1>" + siteTitle + "</h1>" +
+                "<ul>" + movieList.stream().map(i -> "<li>"+ i + "</li>").collect(Collectors.joining()) + "</ul>" +
+            "</body>" +
+        "<html>";
+
+    public static void main(String args[]) throws Exception {
+        Files.createDirectory(Paths.get("public/"));
+        Files.write(Paths.get("public/index.html"), htmlString.getBytes());
+    }
+}
-- 
GitLab