collections: companion code for the How to Sort a HashMap by Value (and Key) post
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KqJyCidz3ZgRyHABv2GVJh
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file in ../output/. Requires JDK25_HOME.
|
||||
set -euo pipefail
|
||||
[[ -z "${JDK25_HOME:-}" ]] && { echo "JDK25_HOME must be set" >&2; exit 1; }
|
||||
cd "$(dirname "$0")/.."
|
||||
OUT=output; mkdir -p "$OUT"
|
||||
export JAVA_HOME="$JDK25_HOME"
|
||||
mvn -q -f ../pom.xml -pl collections -am package
|
||||
J="$JDK25_HOME/bin/java"
|
||||
run() { echo "==> $1"; "$J" -cp target/classes "com.ankurm.collections.$1" 2>&1 | grep -v "Picked up" > "$OUT/$2"; }
|
||||
run SortByValueDemo 01-sort-by-value.txt
|
||||
run TieBugDemo 02-tie-bug.txt
|
||||
run TopNDemo 03-top-n.txt
|
||||
run SequencedDemo 04-sequenced.txt
|
||||
for b in HashMapIsNotSequenced:05 SortMapDirectly:06; do
|
||||
n=${b%%:*}; k=${b##*:}
|
||||
"$JDK25_HOME/bin/javac" -d /tmp/lc-coll src/broken/$n.java 2>&1 | grep -v "Picked up" > "$OUT/$k-$n-compile-error.txt" || true
|
||||
done
|
||||
echo "==> JMH"
|
||||
"$J" -jar target/benchmarks.jar SortingBenchmark -rf text -rff "$OUT/07-jmh-raw.txt" 2>&1 | grep -v "Picked up" > /dev/null
|
||||
cp target/surefire-reports/com.ankurm.collections.SortingTest.txt "$OUT/08-tests.txt"
|
||||
echo Done
|
||||
Reference in New Issue
Block a user