GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - yukoba/ScalaImmutablePriorityQueue: Scala immutable priority queue

BranchesTags
Open more actions menu

Latest commit

 

History

31 Commits
31 Commits

Folders and files

NameName
Last commit message
Last commit date
project
project
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.scalafmt.conf
.scalafmt.conf
 
 
LICENSE.txt
LICENSE.txt
 
 
build.sbt
build.sbt
 
 
readme.md
readme.md
 
 

Repository files navigation

Scala immutable priority queue

This is an immutable priority queue for Scala. This wraps FingerTree of Scalaz.

Usage

import jp.yukoba.collection.immutable.PriorityQueue

case class Test(name: String, priority: Int) extends Ordered[Test]:
    override def compare(that: Test): Int = priority compare that.priority

val queue1 = PriorityQueue(Test("b", 2), Test("d", 4), Test("c", 3))
val queue2 = queue1.enqueue(Test("a", 1))

println(s"queue2 = $queue2")
println(s"queue2.head = ${queue2.head}")
println(s"queue2.tail = ${queue2.tail}")
println(s"queue2.dequeue = ${queue2.dequeue}")
println(s"queue2.dequeueOption = ${queue2.dequeueOption}")
println(s"queue2(3) = ${queue2(3)}")

Output

queue2 = PriorityQueue(Test(d,4), Test(c,3), Test(b,2), Test(a,1))
queue2.head = Test(d,4)
queue2.tail = PriorityQueue(Test(c,3), Test(b,2), Test(a,1))
queue2.dequeue = (Test(d,4),PriorityQueue(Test(c,3), Test(b,2), Test(a,1)))
queue2.dequeueOption = Some((Test(d,4),PriorityQueue(Test(c,3), Test(b,2), Test(a,1))))
queue2(3) = Test(a,1)

About

Scala immutable priority queue

Topics

scala

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.