Single OsidList Pattern

Wraps exactly one OsidObject in the OsidList interface — no collection needed.

Overview

The single-element OsidList wraps exactly one object. It is the lightest possible OsidList and avoids constructing any collection when only one result exists. available() returns 1 until the element is consumed, then 0. hasNext() returns true exactly once.

Javadoc Reference

net.okapia.osid.jamocha.spi

Class Declaration Pattern

public final class SingleOsidObjectList
extends Object
implements OsidObjectList

Constructor Pattern

SingleOsidObjectList(OsidObject element)
ParameterTypeDescription
element OsidObject the single element to expose

Static Factory Method Pattern

static OsidObjectList of(OsidObject element)
ParameterTypeDescription
element OsidObject the element

Returns OsidObjectList