From 81c87f1bd3f80ff91a718ecf7da838aa7d677a85 Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Sat, 28 Mar 2026 06:52:50 +0100 Subject: [PATCH] refactor: add type parameters to Java collection types in java-collections.md Flix now supports proper generics for Java interop types. Update all function signatures to use parameterized types (e.g. JList[a], JMap[k, v]) instead of raw types. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/java-collections.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/java-collections.md b/src/java-collections.md index 320b2322..e687c002 100644 --- a/src/java-collections.md +++ b/src/java-collections.md @@ -25,21 +25,21 @@ The following functions _convert_ Flix collections to Java collections: /// /// Lists /// -def toList(ma: m[a]): JList \ IO + Aef[m] with Foldable[m] -def toArrayList(ma: m[a]): JArrayList \ IO + Aef[m] with Foldable[m] -def toLinkedList(ma: m[a]): JLinkedList \ IO + Aef[m] with Foldable[m] +def toList(ma: m[a]): JList[a] \ IO + Aef[m] with Foldable[m] +def toArrayList(ma: m[a]): JArrayList[a] \ IO + Aef[m] with Foldable[m] +def toLinkedList(ma: m[a]): JLinkedList[a] \ IO + Aef[m] with Foldable[m] /// /// Sets /// -def toSet(ma: m[a]): JSet \ IO + Aef[m] with Order[a], Foldable[m] -def toTreeSet(ma: m[a]): JTreeSet \ IO + Aef[m] with Order[a], Foldable[m] +def toSet(ma: m[a]): JSet[a] \ IO + Aef[m] with Order[a], Foldable[m] +def toTreeSet(ma: m[a]): JTreeSet[a] \ IO + Aef[m] with Order[a], Foldable[m] /// /// Maps /// -def toMap(m: Map[k, v]): JMap \ IO with Order[k] -def toTreeMap(m: Map[k, v]): JTreeMap \ IO with Order[k] +def toMap(m: Map[k, v]): JMap[k, v] \ IO with Order[k] +def toTreeMap(m: Map[k, v]): JTreeMap[k, v] \ IO with Order[k] ``` Each function constructs a new collection and copies all its elements into it. @@ -52,13 +52,13 @@ The following functions _convert_ Java collections to Flix collections: ```flix /// Lists -def fromList(l: JList): List[a] +def fromList(l: JList[a]): List[a] /// Sets -def fromSet(l: JSet): Set[a] with Order[a] +def fromSet(l: JSet[a]): Set[a] with Order[a] /// Maps -def fromMap(m: JMap): Map[k, v] with Order[k] +def fromMap(m: JMap[k, v]): Map[k, v] with Order[k] ``` Each function constructs a new Flix collection from a Java Collection. Hence