scala.collection.immutable

object Nil

[source: scala/collection/immutable/Nil.scala]

case object Nil
extends List[Nothing]
The empty list.
Author
Martin Odersky
Version
1.0, 15/07/2003
Method Summary
override def canEqual (arg0 : Any) : Boolean
An equality helper method to assist in maintaining reflexivity in the face of subtyping. For more, see http://www.artima.com/lejava/articles/equality.html
override def equals (that : Any) : Boolean
This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.
override def head : Nothing
Returns this first element of the list.
override def isEmpty : Boolean
Returns true if the list does not contain any elements.
override def productArity : Int
return k for a product A(x_1,...,x_k)
override def productElement (arg0 : Int) : Any
for a product A(x_1,...,x_k), returns x_(n+1) for 0 <= n < k
override def productPrefix : java.lang.String
By default the empty string. Implementations may override this method in order to prepend a string prefix to the result of the toString methods.
protected def readResolve : AnyRef
override def tail : List[Nothing]
Returns this list without its first element.
Methods inherited from List
companion, ::, :::, reverse_:::, reverseMap, mapConserve, ++, ++, toList, take, drop, slice, takeRight, splitAt, takeWhile, dropWhile, span, reverse, stringPrefix, toStream, --, -, sort
Methods inherited from Product
productIterator, productElements
Methods inherited from LinearSequenceTemplate
length, apply, iterator, foreach, forall, exists, count, find, foldLeft, foldRight, reduceLeft, reduceRight, last, dropRight, sameElements, lengthCompare, isDefinedAt, segmentLength, indexWhere, lastIndexWhere
Methods inherited from Sequence
hashCode
Methods inherited from SequenceTemplate
size, zip, zipAll, zipWithIndex, prefixLength, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, reverseIterator, reversedElements, startsWith, startsWith, endsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, padTo, toSequence, indices, view, view, toString, sortWith, findLastIndexOf, slice, equalsWith, containsSlice, projection
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from IterableTemplate
elements, toIterable, first, firstOption, toSeq
Methods inherited from TraversableClass
newBuilder, genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableTemplate
thisCollection, nonEmpty, hasDefiniteSize, map, flatMap, filter, filterMap, filterNot, remove, partition, groupBy, /:, :\, reduceLeftOption, reduceRightOption, headOption, lastOption, init, copyToBuffer, copyToArray, copyToArray, toArray, toSet, mkString, mkString, mkString, addString, addString, addString
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def isEmpty : Boolean
Returns true if the list does not contain any elements.
Returns
true, iff the list is empty.
Overrides
List.isEmpty

override def head : Nothing
Returns this first element of the list.
Returns
the first element of this list.
Throws
Predef.NoSuchElementException - if the list is empty.
Overrides
List.head

override def tail : List[Nothing]
Returns this list without its first element.
Returns
this list without its first element.
Throws
Predef.NoSuchElementException - if the list is empty.
Overrides
List.tail

override def equals(that : Any) : Boolean
This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

The default implementations of this method is an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

Parameters
arg0 - the object to compare against this object for equality.
Returns
true if the receiver object is equivalent to the argument; false otherwise.


override def productPrefix : java.lang.String
By default the empty string. Implementations may override this method in order to prepend a string prefix to the result of the toString methods.

override def productArity : Int
return k for a product A(x_1,...,x_k)

override def productElement(arg0 : Int) : Any
for a product A(x_1,...,x_k), returns x_(n+1) for 0 <= n < k
Parameters
n - the index of the element to return
Throws
IndexOutOfBoundsException -
Returns
The element n elements after the first element

override def canEqual(arg0 : Any) : Boolean
An equality helper method to assist in maintaining reflexivity in the face of subtyping. For more, see http://www.artima.com/lejava/articles/equality.html

protected def readResolve : AnyRef