Scoop API

scoop:scoop.std:0.1.0

PriorityQueue

class PriorityQueue

source · line 9
public
public class PriorityQueue<T> public constructor(
    /**
     * The comparator used for ordering and, for ordered maps/sets, equivalence.
     */
    public val comparator: Comparator<T>) : Collection<T>

A binary min-heap ordered by its comparator. Removal returns the smallest element; iteration exposes heap order, not sorted order. Structural changes invalidate iterators.

property comparator

source · line 13
public
public val comparator: Comparator<T>

get: public read-only

The comparator used for ordering and, for ordered maps/sets, equivalence.

function peek

source · line 64
public
public fun peek(): T

Returns the smallest element without removal; an empty queue throws NoSuchElementException.

function peekOrNone

source · line 72
public
public fun peekOrNone(): T?

Returns the smallest element without removal, or None when empty.

function iterator

source · line 129
public
public override operator fun iterator(): Iterator<T>

Iterates in heap storage order, which is not sorted; structural changes invalidate the iterator.

function removeFirstOrNone

source · line 76
public
public fun removeFirstOrNone(): T?

Removes the smallest element, or returns None when empty.

function removeFirst

source · line 81
public
public fun removeFirst(): T

Removes the smallest element; an empty queue throws NoSuchElementException.