This Advent of Code attempt is written in Java 23.0.1
Here's my attempt at the Advent of Code 2024. I'm using Java 23.0.1, IntelliJ IDEA 2024 & Copilot (only for language help and boilerplate)
Overall, the main approach is functional programming as much as possible; i.e. the Streams API and other language features. My idea was also to leverage Java 21+ features at every opportunity, such as the new switch expressions and pattern matching.
D:\Lib\jdk-23.0.1\bin\java.exe --enable-preview
"-javaagent:C:\Users\Kings\AppData\Local\Programs\IntelliJ IDEA Ultimate\..."
-Dfile.encoding=UTF-8
-classpath C:\Users\Kings\Documents\Projects\AoC\2024\aoc2024\target\classes...
Main
***************************
*** Advent of Code 2024 ***
***************************
https://adventofcode.com/2024/day/1
Day 1 (part 1): Historian Hysteria
The answer is total distance = 1579939
Day 1 (part 2): Historian Hysteria
The answer is total similarity score = 20351745
https://adventofcode.com/2024/day/2
Day 2 (part 1): Red-Nosed Reports
The answer is total safe reports = 356
Day 2 (part 2): Red-Nosed Reports
The answer is total adjusted safe reports = 413
https://adventofcode.com/2024/day/3
Day 3 (part 1): Mull It Over
The answer is total sum of multiplications = 169021493
Day 3 (part 2): Mull It Over
The answer is total sum of enabled multiplications = 111762583
https://adventofcode.com/2024/day/4
Day 4 (part 1): Ceres Search
The answer is total occurrences of word = 2358
This is a bunch of references mostly about functional programming and using Streams API in Java 21+
- https://medium.com/javarevisited/whats-new-with-java-23-698762aa44d1
- https://stackify.com/streams-guide-java-8/
- https://bell-sw.com/blog/a-guide-to-java-stream-api/
- https://www.happycoders.eu/java/stream-gatherers/
- Some window and groupby examples in Java, Python, R and Scala
- Stuff from the vavr guy about the vavr package and functional programming in Java
There's a good chance I will not complete all the days, but what days I do complete I will also replicate in separate projects based on Python and Go. This is to compare similar approaches to the same problems with different languages.
EOF