Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.collections
Class MergedList<E>

    java.lang.Object
      java.util.AbstractCollection<E>
          umontreal.iro.lecuyer.collections.MergedCollection<E>
              umontreal.iro.lecuyer.collections.MergedList<E>

Type Parameters:
  `E` - the type of the element in the merged list.

All Implemented Interfaces:
  Iterable<E>, Collection<E>, List<E>

    public class MergedList<E>

extends MergedCollection<E>
implements List<E>

Represents a list providing a view of two lists side by side. This extends the merged collection for implementing the `List` interface.

Constructor Summary
`MergedList(List<? extends E> list1, List<? extends E> list2)` Constructs a new merged list from lists `list1` and `list2`.

Method Summary
`void` | `add(int index, E element)`
`boolean` | `addAll(int index, Collection<? extends E> c)`
`boolean` | `equals(Object o)`
`E` | `get(int index)`
`List<? extends E>` | `getFirstCollection()` Returns the reference to the first list in this merged list.
`List<? extends E>` | `getSecondCollection()` Returns the reference to the second list in this merged list.
`int` | `hashCode()`
`int` | `indexOf(Object o)`
`int` | `lastIndexOf(Object o)`
`ListIterator<E>` | `listIterator()`
`ListIterator<E>` | `listIterator(int index)`
`static
`<E> MergedList<E>`
` | `newRandomAccess(List<? extends E> list1, List<? extends E> list2)` Attempts to construct a random-accessible merged list.
`E` | `remove(int index)`
`E` | `set(int index, E element)`
`List<E>` | `subList(int fromIndex, int toIndex)`
`MergedList<E>` | `tryToMakeRandomAccess()` Attempts to make this merged list random-accessible, i.e., supporting fast random access.

Methods inherited from class umontreal.iro.lecuyer.collections.MergedCollection
`contains, isEmpty, iterator, size`

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

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

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

Constructor Detail

### MergedList

    public MergedList(List<? extends E> list1,
                      List<? extends E> list2)

  Constructs a new merged list from lists `list1` and `list2`.

  Parameters:
    `list1` - the first list.
    `list2` - the second list.
  Throws:
    `NullPointerException` - if `list1` or `list2` are `null`.

Method Detail

### getFirstCollection

    public List<? extends E> getFirstCollection()

  Returns the reference to the first list in this merged list.

  Overrides:
    `getFirstCollection` in class `MergedCollection<E>`
  Returns:
    the first list.

### getSecondCollection

    public List<? extends E> getSecondCollection()

  Returns the reference to the second list in this merged list.

  Overrides:
    `getSecondCollection` in class `MergedCollection<E>`
  Returns:
    the second list.

### tryToMakeRandomAccess

    public MergedList<E> tryToMakeRandomAccess()

  Attempts to make this merged list random-accessible, i.e., supporting fast random access. If both inner lists implement the `RandomAccess` interface, this method returns a merged list implementing `RandomAccess`. Otherwise, the method returns this reference.

  Returns:
    the merged list, possibly random-accessible.

### newRandomAccess

    public static <E> MergedList<E> newRandomAccess(List<? extends E> list1,
                                                    List<? extends E> list2)

  Attempts to construct a random-accessible merged list. If `list1` and `list2` both implement `RandomAccess`, this constructs and returns a list implementing `RandomAccess`. Otherwise, the constructed list does not implement the interface.

  Type Parameters:
    `E` - the type of elements in the merged list.
  Parameters:
    `list1` - the first list.
    `list2` - the second list.
  Returns:
    the constructed list.
  Throws:
    `NullPointerException` - if `list1` or `list2` are `null`.

### equals

    public boolean equals(Object o)

  Specified by:
    `equals` in interface `Collection<E>`
  Specified by:
    `equals` in interface `List<E>`
  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `Collection<E>`
  Specified by:
    `hashCode` in interface `List<E>`
  Overrides:
    `hashCode` in class `Object`

### get

    public E get(int index)

  Specified by:
    `get` in interface `List<E>`

### indexOf

    public int indexOf(Object o)

  Specified by:
    `indexOf` in interface `List<E>`

### lastIndexOf

    public int lastIndexOf(Object o)

  Specified by:
    `lastIndexOf` in interface `List<E>`

### listIterator

    public ListIterator<E> listIterator()

  Specified by:
    `listIterator` in interface `List<E>`

### listIterator

    public ListIterator<E> listIterator(int index)

  Specified by:
    `listIterator` in interface `List<E>`

### add

    public void add(int index,
                    E element)

  Specified by:
    `add` in interface `List<E>`

### addAll

    public boolean addAll(int index,
                          Collection<? extends E> c)

  Specified by:
    `addAll` in interface `List<E>`

### remove

    public E remove(int index)

  Specified by:
    `remove` in interface `List<E>`

### set

    public E set(int index,
                 E element)

  Specified by:
    `set` in interface `List<E>`

### subList

    public List<E> subList(int fromIndex,
                           int toIndex)

  Specified by:
    `subList` in interface `List<E>`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.