Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port TopologicalSort to Java #4110

Merged
merged 1 commit into from Mar 19, 2024
Merged

Port TopologicalSort to Java #4110

merged 1 commit into from Mar 19, 2024

Conversation

Scott-Guest
Copy link
Contributor

Part of #4030

Ports the TopologicalSort class to Java.

Once again, this is a direct translation, replacing functional idioms with either direct iteration or equivalent Stream functions. The only semantic change is returning an Optional rather than reporting an error when there's a cycle.

@Scott-Guest Scott-Guest self-assigned this Mar 19, 2024
@@ -19,7 +19,6 @@ object Collections {
def immutable[T](s: java.util.Set[T]): Set[T] = s.asScala.toSet
def immutable[T](s: java.util.List[T]): Seq[T] = s.asScala
def immutable[K, V](s: java.util.Map[K, V]): Map[K, V] = s.asScala
def immutable[T](s: Array[T]): Seq[T] = s
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because it overlaps with the immutable[T](s: java.util.List[T]): Seq[T] overload, making the latter unusable (and it's dead code anyways).

@Scott-Guest Scott-Guest marked this pull request as ready for review March 19, 2024 05:37
@rv-jenkins rv-jenkins merged commit 35e32e9 into develop Mar 19, 2024
8 checks passed
@rv-jenkins rv-jenkins deleted the java-tsort branch March 19, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants