edu.mit.csail.sdg.alloy4
Class ConstList.TempList<T>

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4.ConstList.TempList<T>
Type Parameters:
T - - the type of element
Enclosing class:
ConstList<T>

public static final class ConstList.TempList<T>
extends java.lang.Object

Mutable; this implements a modifiable list that can be used to construct a ConstList; null values are allowed.


Constructor Summary
ConstList.TempList()
          Construct an empty TempList.
ConstList.TempList(java.util.Collection<? extends T> all)
          Construct a new TempList whose initial content is equal to the given collection.
ConstList.TempList(int n)
          Construct an empty TempList with initial capacity of n (if n<=0, the list will be given a default capacity of 0)
ConstList.TempList(int n, T elem)
          Construct a new TempList whose initial content is n references to the given elem (if n<=0, the created list is empty)
ConstList.TempList(T... all)
          Construct a new TempList whose initial content is equal to the given array.
 
Method Summary
 ConstList.TempList<T> add(T elem)
          Appends the given element to the list, then return itself.
 ConstList.TempList<T> addAll(java.lang.Iterable<? extends T> all)
          Appends the elements in the given collection to the list, then return itself.
 ConstList.TempList<T> clear()
          Removes every element, then return itself.
 boolean contains(T elem)
          Returns true if the element is in the list.
 T get(int index)
          Returns the i-th element.
 ConstList<T> makeConst()
          Makes this TempList unmodifiable, then construct a ConstList backed by this TempList.
 T remove(int index)
          Removes then returns the i-th element.
 ConstList.TempList<T> set(int index, T elem)
          Changes the i-th element to be the given element, then return itself.
 int size()
          Returns the size of the list.
 java.lang.String toString()
          Returns a String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstList.TempList

public ConstList.TempList()
Construct an empty TempList.


ConstList.TempList

public ConstList.TempList(int n)
Construct an empty TempList with initial capacity of n (if n<=0, the list will be given a default capacity of 0)


ConstList.TempList

public ConstList.TempList(int n,
                          T elem)
Construct a new TempList whose initial content is n references to the given elem (if n<=0, the created list is empty)


ConstList.TempList

public ConstList.TempList(java.util.Collection<? extends T> all)
Construct a new TempList whose initial content is equal to the given collection.


ConstList.TempList

public ConstList.TempList(T... all)
Construct a new TempList whose initial content is equal to the given array.

Method Detail

toString

public java.lang.String toString()
Returns a String representation.

Overrides:
toString in class java.lang.Object

size

public int size()
Returns the size of the list.


contains

public boolean contains(T elem)
Returns true if the element is in the list.


get

public T get(int index)
Returns the i-th element.


remove

public T remove(int index)
Removes then returns the i-th element.


clear

public ConstList.TempList<T> clear()
Removes every element, then return itself.


add

public ConstList.TempList<T> add(T elem)
Appends the given element to the list, then return itself.


addAll

public ConstList.TempList<T> addAll(java.lang.Iterable<? extends T> all)
Appends the elements in the given collection to the list, then return itself.


set

public ConstList.TempList<T> set(int index,
                                 T elem)
Changes the i-th element to be the given element, then return itself.


makeConst

public ConstList<T> makeConst()
Makes this TempList unmodifiable, then construct a ConstList backed by this TempList.