com.tensegrity.generic.util
Class NonRandomAccessLinkedList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.AbstractSequentialList
              extended byjava.util.LinkedList
                  extended bycom.tensegrity.generic.util.NonRandomAccessLinkedList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public final class NonRandomAccessLinkedList
extends java.util.LinkedList

A simple linkedlist wrapper that explicitly DISALLOWS random access. (Random access is accessing the n'th element, which is terribly inefficient for a linked list). This list is a wrapper to track such attempts and to avoid them. Performance will greatly benefit from avoiding such malicious usages of linkedlists. The contract of NonRandomAccessLinkedList disallows all random-access and will throw an UnsupportedOperationException if one occurs.

Version:
$Id: NonRandomAccessLinkedList.java,v 1.6 2003/09/04 11:52:22 AndreasEbbert Exp $
Author:
S.Rutz
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
NonRandomAccessLinkedList()
          Constructs a new empty NonRandomAccessLinkedList.
NonRandomAccessLinkedList(java.util.Collection collection)
          Constructs a new NonRandomAccessLinkedList that is initially filled with all the objects that are contained in the given collection.
 
Method Summary
 boolean contains(java.lang.Object o)
          Forbidden by NonRandomAccessLinkedLIst contract
 java.lang.Object get(int index)
          Forbidden by NonRandomAccessLinkedLIst contract
 int indexOf(java.lang.Object o)
          Forbidden by NonRandomAccessLinkedLIst contract
 int lastIndexOf(java.lang.Object o)
          Forbidden by NonRandomAccessLinkedLIst contract
 java.lang.Object remove(int index)
          Forbidden by NonRandomAccessLinkedLIst contract
 boolean remove(java.lang.Object o)
          Forbidden by NonRandomAccessLinkedLIst contract
 java.lang.Object set(int index, java.lang.Object element)
          Forbidden by NonRandomAccessLinkedLIst contract
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, getFirst, getLast, listIterator, removeFirst, removeLast, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

NonRandomAccessLinkedList

public NonRandomAccessLinkedList(java.util.Collection collection)
Constructs a new NonRandomAccessLinkedList that is initially filled with all the objects that are contained in the given collection.

Parameters:
collection - a collection whose values are to put inserted into the created NonRandomAccessLinkedList instance.

NonRandomAccessLinkedList

public NonRandomAccessLinkedList()
Constructs a new empty NonRandomAccessLinkedList.

Method Detail

contains

public boolean contains(java.lang.Object o)
Forbidden by NonRandomAccessLinkedLIst contract


get

public java.lang.Object get(int index)
Forbidden by NonRandomAccessLinkedLIst contract


indexOf

public int indexOf(java.lang.Object o)
Forbidden by NonRandomAccessLinkedLIst contract


lastIndexOf

public int lastIndexOf(java.lang.Object o)
Forbidden by NonRandomAccessLinkedLIst contract


remove

public java.lang.Object remove(int index)
Forbidden by NonRandomAccessLinkedLIst contract


remove

public boolean remove(java.lang.Object o)
Forbidden by NonRandomAccessLinkedLIst contract


set

public java.lang.Object set(int index,
                            java.lang.Object element)
Forbidden by NonRandomAccessLinkedLIst contract



Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.