# OpenORB 1.3.1: Class MergeStack

## org.openorb.util
Class MergeStack

    java.lang.Object
      |
      +--java.util.AbstractCollection
            |
            +--java.util.AbstractList
                  |
                  +--java.util.AbstractSequentialList
                        |
                        +--org.openorb.util.MergeStack

All Implemented Interfaces:
  java.util.Collection, java.util.List

public class MergeStack
extends java.util.AbstractSequentialList

A weak set. This does not prevent it's members being reclaimed by the garbage collector.

Version:
  $Revision: 1.12 $ $Date: 2002/07/14 19:12:39 $
Author:
  Chris Wood

Constructor Summary
`MergeStack()` Constructs a new, empty list.
`MergeStack(int allocInc)` Constructs a new, empty list with the given allocation increment.

Method Summary
`boolean` `add(java.lang.Object obj)` Appends the specified element to the end of this stack (optional operation).
`void` `addFirst(java.lang.Object obj)` Add a new element to the front of the stack.
`void` `addLast(java.lang.Object obj)` Add a new element to the end of the stack.
`void` `append(MergeStack next)` Append another MergeStack onto this one.
`void` `clear()` Removes all of the elements from this collection.
`java.lang.Object` `getFirst()` Get the first element in the list.
`java.lang.Object` `getLast()` Get the first element in the list.
`java.util.ListIterator` `listIterator(int index)` Returns a list iterator over the elements in this list (in proper sequence).
`java.lang.Object` `removeFirst()` Remove and return the first element in the list.
`java.lang.Object` `removeLast()` Remove and return the last element in the list.
`int` `size()` Returns the number of elements in this collection.

Methods inherited from class java.util.AbstractSequentialList
`add, addAll, get, iterator, remove, set`

Methods inherited from class java.util.AbstractList
`equals, hashCode, indexOf, lastIndexOf, listIterator, subList`

Methods inherited from class java.util.AbstractCollection
`addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.List
`addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray`

Constructor Detail

### MergeStack

    public MergeStack()

  Constructs a new, empty list.

### MergeStack

    public MergeStack(int allocInc)

  Constructs a new, empty list with the given allocation increment.
  Parameters:
    `allocInc` - The increment value for new allocations.

Method Detail

### clear

    public void clear()

  Removes all of the elements from this collection. The collection will be empty after this call returns.
  Overrides:
    `clear` in class `java.util.AbstractList`

### listIterator

    public java.util.ListIterator listIterator(int index)

  Returns a list iterator over the elements in this list (in proper sequence).
  Overrides:
    `listIterator` in class `java.util.AbstractSequentialList`
  Parameters:
    `index` - ???
  Returns:
    A list iterator over the elements in this list (in proper sequence).

### size

    public int size()

  Returns the number of elements in this collection. If the collection contains more than `Integer.MAX_VALUE` elements, returns `Integer.MAX_VALUE`.
  Overrides:
    `size` in class `java.util.AbstractCollection`
  Returns:
    the number of elements in this collection.

### add

    public boolean add(java.lang.Object obj)

  Appends the specified element to the end of this stack (optional operation).

  Overrides:
    `add` in class `java.util.AbstractList`
  Parameters:
    `obj` - The element to be appended to this stack.
  Returns:
    `true` (as per the general contract of `Collection.add`).

### getFirst

    public java.lang.Object getFirst()
                              throws java.util.NoSuchElementException

  Get the first element in the list.
  Returns:
    the first element from the list
  Throws:
    `java.util.NoSuchElementException` - if the list is empty.

### addFirst

    public void addFirst(java.lang.Object obj)

  Add a new element to the front of the stack.
  Parameters:
    `obj` - The object to add to the stack.

### removeFirst

    public java.lang.Object removeFirst()
                                 throws java.util.NoSuchElementException

  Remove and return the first element in the list.
  Returns:
    The first element from the list.
  Throws:
    `java.util.NoSuchElementException` - if the list is empty.

### getLast

    public java.lang.Object getLast()
                             throws java.util.NoSuchElementException

  Get the first element in the list.
  Returns:
    The first element from the list.
  Throws:
    `java.util.NoSuchElementException` - if the list is empty.

### addLast

    public void addLast(java.lang.Object obj)

  Add a new element to the end of the stack.
  Parameters:
    `obj` - The new element to add to the stack.

### removeLast

    public java.lang.Object removeLast()
                                throws java.util.NoSuchElementException

  Remove and return the last element in the list.
  Returns:
    the last element from the list
  Throws:
    `java.util.NoSuchElementException` - if the list is empty.

### append

    public void append(MergeStack next)

  Append another MergeStack onto this one. The other merge stack will end up empty.
  Parameters:
    `next` - Another MergeStack instance to append.