IterableOnceExtension

flatgraph.traversal.IterableOnceExtension
final class IterableOnceExtension[A](val iterable: IterableOnce[A]) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Value members

Concrete methods

def loneElement: A

Attributes

See also
loneElement(hint)
def loneElement(hint: String): A

Attributes

Returns

the one and only element from an Iterable

Throws
AssertionError

if the Iterable has more than one element

NoSuchElementException

if the Iterable is empty

def loneElementOption: Option[A]

Attributes

Returns
Some(element)

if the Iterable has exactly one element, or

None

if the Iterable has zero or more than 1 element. Note: if the lone element is

null

, this will return

Some(null)

, which is in accordance with how

headOption

works.

Concrete fields

val iterable: IterableOnce[A]