Type Hierarchy:

- Anything
  - Object
    - Singleton<out Element>

Satisfied Interfaces: Category, Cloneable<List<Element>>, Collection<Element>, Correspondence<Integer,Element>, Iterable<Element,Nothing>, List<Element>, Ranged<Integer,List<Element>>, Sequence<Element>, Sequential<Element>

A sequence with exactly one element, which may be null.

Initializer
Singleton(Element element)

Attributes
clone | Source Code shared actual Singleton<Element> clone Returns a `Singleton` with the same element. Refined declaration: clone
coalesced | Source Code shared actual {<Element&Object>*} coalesced Returns the Singleton itself, or empty Refined declaration: coalesced
first | Source Code shared actual Element first Returns the element contained in this `Singleton`. Refined declaration: first
hash | Source Code shared actual Integer hash The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that if `x==y` then `x.hash==y.hash`. Refined declaration: hash
last | Source Code shared actual Element last Returns the element contained in this `Singleton`. Refined declaration: last
lastIndex | Source Code shared actual Integer lastIndex Returns `0`. Refined declaration: lastIndex
rest | Source Code shared actual [] rest Returns `Empty`. Refined declaration: rest
reversed | Source Code shared actual Singleton<Element> reversed Return this singleton. Refined declaration: reversed
size | Source Code shared actual Integer size Returns `1`. Refined declaration: size
string | Source Code shared actual String string A developer-friendly string representing the instance. Concatenates the name of the concrete class of the instance with the `hash` of the instance. Subclasses are encouraged to refine this implementation to produce a more meaningful representation. Refined declaration: string

Inherited Attributes
Attributes inherited from: Cloneable<Clone> clone
Attributes inherited from: Collection<Element> string
Attributes inherited from: Correspondence<Key,Item> keys
Attributes inherited from: Iterable<Element,Absent> coalesced, cycled, empty, first, indexed, last, rest, sequence, size, string
Attributes inherited from: List<Element> hash, lastIndex, reversed
Attributes inherited from: [Element+] string
Attributes inherited from: Element[] string

Methods
any | Source Code shared actual Boolean any(Boolean selecting(Element e)) Return `true` if at least one element satisfies the predicate function. Refined declaration: any
contains | Source Code shared actual Boolean contains(Object element) Returns `true` if the specified element is this `Singleton`'s element. Refined declaration: contains
count | Source Code shared actual Integer count(Boolean selecting(Element element)) Returns `1` if this `Singleton`'s element satisfies the predicate, or `0` otherwise. Refined declaration: count
equals | Source Code shared actual Boolean equals(Object that) A `Singleton` can be equal to another `List` if that `List` has only one element which is equal to this `Singleton`'s element. Refined declaration: equals
every | Source Code shared actual Boolean every(Boolean selecting(Element e)) Return `true` if all elements satisfy the predicate function. Refined declaration: every
filter | Source Code shared actual Singleton<Element>|[] filter(Boolean selecting(Element e)) An `Iterable` containing the elements of this container that satisfy the given predicate. Refined declaration: filter
find | Source Code shared actual Element? find(Boolean selecting(Element e)) The first element which satisfies the given predicate, if any, or `null` otherwise. Refined declaration: find
findLast | Source Code shared actual default Element? findLast(Boolean selecting(Element elem)) The last element which satisfies the given predicate, if any, or `null` otherwise. Refined declaration: findLast
fold | Source Code shared actual Result fold<Result>(Result initial, Result accumulating(Result partial, Element e)) The result of applying the accumulating function to each element of this container in turn. Refined declaration: fold
get | Source Code shared actual Element? get(Integer index) Returns the contained element, if the specified index is `0`. Refined declaration: get
iterator | Source Code shared actual default Iterator<Element> iterator() An iterator for the elements belonging to this container. Refined declaration: iterator
map | Source Code shared actual [Result+] map<Result>(Result selecting(Element e)) An `Iterable` containing the results of applying the given mapping to the elements of to this container. Refined declaration: map
segment | Source Code shared actual []|Singleton<Element> segment(Integer from, Integer length) Returns a `Singleton` if the given starting index is `0` and the given `length` is greater than `0`. Otherwise, returns an instance of `Empty`. Refined declaration: segment
skipping | Source Code shared actual Singleton<Element>|[] skipping(Integer skip) Produce an `Iterable` containing the elements of this iterable object, after skipping the first `skip` elements. If this iterable object does not contain more elements than the specified number of elements, the `Iterable` contains no elements. Refined declaration: skipping
sort | Source Code shared actual Singleton<Element> sort(Comparison comparing(Element a, Element b)) A sequence containing the elements of this container, sorted according to a function imposing a partial order upon the elements. For convenience, the functions `byIncreasing()` and `byDecreasing()` produce a suitable comparison function:
    "Hello World!".sort(byIncreasing((Character c) => c.lowercased))
This operation is eager by nature. Refined declaration: sort
span | Source Code shared actual []|Singleton<Element> span(Integer from, Integer to) Returns a `Singleton` if the given starting index is `0`. Otherwise, returns an instance of `Empty`. Refined declaration: span
spanFrom | Source Code shared actual []|Singleton<Element> spanFrom(Integer from) Obtain a span containing the mapped values between the starting index and the end of the receiver. Refined declaration: spanFrom
spanTo | Source Code shared actual []|Singleton<Element> spanTo(Integer to) Obtain a span containing the mapped values between the start of the receiver and the end index. Refined declaration: spanTo
taking | Source Code shared actual Singleton<Element>|[] taking(Integer take) Produce an `Iterable` containing the first `take` elements of this iterable object. If the specified number of elements is larger than the number of elements of this iterable object, the `Iterable` contains the same elements as this iterable object. Refined declaration: taking

Inherited Methods
Methods inherited from: Category contains, containsAny, containsEvery
Methods inherited from: Correspondence<Key,Item> defines, definesAny, definesEvery, get, items
Methods inherited from: Iterable<Element,Absent> any, by, chain, collect, count, cycle, defaultNullElements, every, filter, find, findLast, fold, following, iterator, longerThan, map, repeat, select, shorterThan, skipping, skippingWhile, sort, taking, takingWhile
Methods inherited from: List<Element> endsWith, equals, firstInclusion, firstOccurrence, includes, includesAt, inclusions, indexes, initial, lastInclusion, lastOccurrence, occurrences, occurs, occursAt, startsWith, terminal, trim, trimLeading, trimTrailing, withLeading, withTrailing
Methods inherited from: Ranged<Index,Span> segment, span, spanFrom, spanTo