firstAdjacentPair

fun <K : Comparable<K>> firstAdjacentPair(frames: Map<K, Frame>, successor: (K) -> K, rowTolerance: Float = DEFAULT_ROW_TOLERANCE): Pair<Frame, Frame>?(source)

Finds the first pair of frames, in ascending key order, whose key and successor share a row.

Keys whose successor is missing, does not advance the key, or starts a new row are skipped. Use it to find two adjacent items, such as consecutive days in a calendar row, before checking their order with follows.

Return

The first and second frames, or null when no adjacent pair shares a row.

Parameters

frames

Frames by key, such as item index or date.

successor

Returns the key that should follow a given key.

rowTolerance

The exclusive tolerance for sharing a row.