module Immutable::EmptyList

A list without any elements. This is a singleton, since all empty lists are equivalent. @private

Public Class Methods

cached_size?() click to toggle source
# File lib/immutable/list.rb, line 1590
def cached_size?
  true
end
empty?() click to toggle source
# File lib/immutable/list.rb, line 1579
def empty?
  true
end
first()
Alias for: head
head() click to toggle source

There is no first item in an empty list, so return `nil`. @return [nil]

# File lib/immutable/list.rb, line 1568
def head
  nil
end
Also aliased as: first
length()
Alias for: size
size() click to toggle source

Return the number of items in this `List`. @return [Integer]

# File lib/immutable/list.rb, line 1585
def size
  0
end
Also aliased as: length
tail() click to toggle source

There are no subsequent elements, so return an empty list. @return [self]

# File lib/immutable/list.rb, line 1575
def tail
  self
end