Class ImmutableList<A>

java.lang.Object
java.util.AbstractCollection<A>
com.strobel.collections.ImmutableList<A>
All Implemented Interfaces:
Iterable<A>, Collection<A>, List<A>, SequencedCollection<A>

public class ImmutableList<A> extends AbstractCollection<A> implements List<A>
A class for generic linked lists. Links are supposed to be immutable, the only exception being the incremental construction of lists via ListBuffers. List is the main container class in GJC. Most data structures and algorithms in GJC use lists rather than arrays.

Lists are always trailed by a sentinel element, whose head and tail are both null.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

  • Field Details

    • tail

      public ImmutableList<A> tail
      The remainder of the list except for its first element, supposed to be immutable.
    • EMPTY_LIST

      private static final ImmutableList<?> EMPTY_LIST
    • EMPTY_ITERATOR

      private static final Iterator<?> EMPTY_ITERATOR
  • Constructor Details

    • ImmutableList

      ImmutableList(A head, ImmutableList<A> tail)
      Construct a list given its head and tail.
  • Method Details