Cleanup of list package.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1361597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
20fdf174fe
commit
5486a179db
|
@ -39,11 +39,7 @@ import org.apache.commons.collections.OrderedIterator;
|
||||||
* is here.
|
* is here.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Rich Dougherty
|
|
||||||
* @author Phil Steitz
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractLinkedList<E> implements List<E> {
|
public abstract class AbstractLinkedList<E> implements List<E> {
|
||||||
|
|
||||||
|
|
|
@ -23,18 +23,16 @@ import java.util.ListIterator;
|
||||||
import org.apache.commons.collections.collection.AbstractCollectionDecorator;
|
import org.apache.commons.collections.collection.AbstractCollectionDecorator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorates another <code>List</code> to provide additional behaviour.
|
* Decorates another {@link List} to provide additional behaviour.
|
||||||
* <p>
|
* <p>
|
||||||
* Methods are forwarded directly to the decorated list.
|
* Methods are forwarded directly to the decorated list.
|
||||||
*
|
*
|
||||||
* @param <E> the type of the elements in the list
|
* @param <E> the type of the elements in the list
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractListDecorator<E> extends AbstractCollectionDecorator<E> implements
|
public abstract class AbstractListDecorator<E> extends AbstractCollectionDecorator<E>
|
||||||
List<E> {
|
implements List<E> {
|
||||||
|
|
||||||
/** Serialization version--necessary in an abstract class? */
|
/** Serialization version--necessary in an abstract class? */
|
||||||
private static final long serialVersionUID = 4500739654952315623L;
|
private static final long serialVersionUID = 4500739654952315623L;
|
||||||
|
|
|
@ -26,8 +26,8 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Serializable subclass of AbstractListDecorator.
|
* Serializable subclass of AbstractListDecorator.
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
|
||||||
* @since Commons Collections 3.1
|
* @since Commons Collections 3.1
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSerializableListDecorator<E>
|
public abstract class AbstractSerializableListDecorator<E>
|
||||||
extends AbstractListDecorator<E>
|
extends AbstractListDecorator<E>
|
||||||
|
@ -37,7 +37,10 @@ public abstract class AbstractSerializableListDecorator<E>
|
||||||
private static final long serialVersionUID = 2684959196747496299L;
|
private static final long serialVersionUID = 2684959196747496299L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor that wraps (not copies).
|
||||||
|
*
|
||||||
|
* @param list the list to decorate, must not be null
|
||||||
|
* @throws IllegalArgumentException if list is null
|
||||||
*/
|
*/
|
||||||
protected AbstractSerializableListDecorator(List<E> list) {
|
protected AbstractSerializableListDecorator(List<E> list) {
|
||||||
super(list);
|
super(list);
|
||||||
|
|
|
@ -53,12 +53,7 @@ import java.util.ListIterator;
|
||||||
*
|
*
|
||||||
* @see java.util.LinkedList
|
* @see java.util.LinkedList
|
||||||
* @since Commons Collections 1.0
|
* @since Commons Collections 1.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Rodney Waldhoff
|
|
||||||
* @author Janek Bogucki
|
|
||||||
* @author Simon Kitching
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
|
public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,7 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
|
||||||
* This class is Serializable from Commons Collections 3.1.
|
* This class is Serializable from Commons Collections 3.1.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
* @author Paul Jack
|
|
||||||
*/
|
*/
|
||||||
public class FixedSizeList<E>
|
public class FixedSizeList<E>
|
||||||
extends AbstractSerializableListDecorator<E>
|
extends AbstractSerializableListDecorator<E>
|
||||||
|
|
|
@ -50,10 +50,7 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @see LazyList
|
* @see LazyList
|
||||||
* @since Commons Collections 3.2
|
* @since Commons Collections 3.2
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
* @author Paul Legato
|
|
||||||
*/
|
*/
|
||||||
public class GrowthList<E> extends AbstractSerializableListDecorator<E> {
|
public class GrowthList<E> extends AbstractSerializableListDecorator<E> {
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,16 @@ import org.apache.commons.collections.Factory;
|
||||||
* For instance:
|
* For instance:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Factory factory = new Factory() {
|
* Factory<Date> factory = new Factory<Date>() {
|
||||||
* public Object create() {
|
* public Date create() {
|
||||||
* return new Date();
|
* return new Date();
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* List lazy = LazyList.decorate(new ArrayList(), factory);
|
* List<Date> lazy = LazyList.decorate(new ArrayList<Date>(), factory);
|
||||||
* Object obj = lazy.get(3);
|
* Date date = lazy.get(3);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* After the above code is executed, <code>obj</code> will contain
|
* After the above code is executed, <code>date</code> will contain
|
||||||
* a new <code>Date</code> instance. Furthermore, that <code>Date</code>
|
* a new <code>Date</code> instance. Furthermore, that <code>Date</code>
|
||||||
* instance is the fourth element in the list. The first, second,
|
* instance is the fourth element in the list. The first, second,
|
||||||
* and third element are all set to <code>null</code>.
|
* and third element are all set to <code>null</code>.
|
||||||
|
@ -55,11 +55,7 @@ import org.apache.commons.collections.Factory;
|
||||||
*
|
*
|
||||||
* @see GrowthList
|
* @see GrowthList
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
* @author Arron Bates
|
|
||||||
* @author Paul Jack
|
|
||||||
*/
|
*/
|
||||||
public class LazyList<E> extends AbstractSerializableListDecorator<E> {
|
public class LazyList<E> extends AbstractSerializableListDecorator<E> {
|
||||||
|
|
||||||
|
@ -108,7 +104,6 @@ public class LazyList<E> extends AbstractSerializableListDecorator<E> {
|
||||||
* placeholder that is replaced with a factory object when requested.
|
* placeholder that is replaced with a factory object when requested.
|
||||||
*
|
*
|
||||||
* @param index the index to retrieve
|
* @param index the index to retrieve
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public E get(int index) {
|
public E get(int index) {
|
||||||
|
|
|
@ -37,12 +37,7 @@ import java.util.Collection;
|
||||||
* <b>Note that this implementation is not synchronized.</b>
|
* <b>Note that this implementation is not synchronized.</b>
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Jeff Varszegi
|
|
||||||
* @author Rich Dougherty
|
|
||||||
* @author Phil Steitz
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public class NodeCachingLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
|
public class NodeCachingLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,7 @@ import java.util.ListIterator;
|
||||||
* This class is Serializable from Commons Collections 3.1.
|
* This class is Serializable from Commons Collections 3.1.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
* @author Paul Jack
|
|
||||||
*/
|
*/
|
||||||
public class PredicatedList<E> extends PredicatedCollection<E> implements List<E> {
|
public class PredicatedList<E> extends PredicatedCollection<E> implements List<E> {
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
|
||||||
* This class is Serializable from Commons Collections 3.1.
|
* This class is Serializable from Commons Collections 3.1.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Matthew Hawthorne
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
* @author Tom Dunham
|
|
||||||
*/
|
*/
|
||||||
public class SetUniqueList<E> extends AbstractSerializableListDecorator<E> {
|
public class SetUniqueList<E> extends AbstractSerializableListDecorator<E> {
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,7 @@ import org.apache.commons.collections.collection.SynchronizedCollection;
|
||||||
* This class is Serializable from Commons Collections 3.1.
|
* This class is Serializable from Commons Collections 3.1.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public class SynchronizedList<E> extends SynchronizedCollection<E> implements List<E> {
|
public class SynchronizedList<E> extends SynchronizedCollection<E> implements List<E> {
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,7 @@ import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
|
||||||
* This class is Serializable from Commons Collections 3.1.
|
* This class is Serializable from Commons Collections 3.1.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public class TransformedList<E> extends TransformedCollection<E> implements List<E> {
|
public class TransformedList<E> extends TransformedCollection<E> implements List<E> {
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,7 @@ import org.apache.commons.collections.OrderedIterator;
|
||||||
* does use slightly more memory.
|
* does use slightly more memory.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.1
|
* @since Commons Collections 3.1
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Joerg Schmuecker
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public class TreeList<E> extends AbstractList<E> {
|
public class TreeList<E> extends AbstractList<E> {
|
||||||
// add; toArray; iterator; insert; get; indexOf; remove
|
// add; toArray; iterator; insert; get; indexOf; remove
|
||||||
|
|
|
@ -33,9 +33,7 @@ import org.apache.commons.collections.iterators.UnmodifiableListIterator;
|
||||||
* Attempts to modify it will result in an UnsupportedOperationException.
|
* Attempts to modify it will result in an UnsupportedOperationException.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Stephen Colebourne
|
|
||||||
*/
|
*/
|
||||||
public final class UnmodifiableList<E>
|
public final class UnmodifiableList<E>
|
||||||
extends AbstractSerializableListDecorator<E>
|
extends AbstractSerializableListDecorator<E>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* This package contains implementations of the {@link java.util.List List} interface.
|
||||||
|
* <p>
|
||||||
|
* The following implementations are provided in the package:
|
||||||
|
* <ul>
|
||||||
|
* <li>TreeList - a list that is optimised for insertions and removals at any index in the list</li>
|
||||||
|
* <li>CursorableLinkedList - a list that can be modified while the listIterator (cursor) is being used</li>
|
||||||
|
* <li>NodeCachingLinkedList - a linked list that caches the storage nodes for a performance gain</li>
|
||||||
|
* </ul>
|
||||||
|
* <p>
|
||||||
|
* The following decorators are provided in the package:
|
||||||
|
* <ul>
|
||||||
|
* <li>Synchronized - synchronizes method access for multi-threaded environments</li>
|
||||||
|
* <li>Unmodifiable - ensures the collection cannot be altered</li>
|
||||||
|
* <li>Predicated - ensures that only elements that are valid according to a predicate can be added</li>
|
||||||
|
* <li>Typed - ensures that only elements that are of a specific type can be added</li>
|
||||||
|
* <li>Transformed - transforms each element added</li>
|
||||||
|
* <li>FixedSize - ensures that the size of the list cannot change</li>
|
||||||
|
* <li>Lazy - creates objects in the list on demand</li>
|
||||||
|
* <li>Growth - grows the list instead of erroring when set/add used with index beyond the list size</li>
|
||||||
|
* <li>SetUnique - a list that avoids duplicate entries like a Set</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
package org.apache.commons.collections.list;
|
|
@ -1,45 +0,0 @@
|
||||||
<!-- $Id$ -->
|
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
|
||||||
this work for additional information regarding copyright ownership.
|
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
(the "License"); you may not use this file except in compliance with
|
|
||||||
the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
<BODY>
|
|
||||||
<p>
|
|
||||||
This package contains implementations of the
|
|
||||||
{@link java.util.List List} interface.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The following implementations are provided in the package:
|
|
||||||
<ul>
|
|
||||||
<li>TreeList - a list that is optimised for insertions and removals at any index in the list</li>
|
|
||||||
<li>CursorableLinkedList - a list that can be modified while the listIterator (cursor) is being used</li>
|
|
||||||
<li>NodeCachingLinkedList - a linked list that caches the storage nodes for a performance gain</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The following decorators are provided in the package:
|
|
||||||
<ul>
|
|
||||||
<li>Synchronized - synchronizes method access for multi-threaded environments</li>
|
|
||||||
<li>Unmodifiable - ensures the collection cannot be altered</li>
|
|
||||||
<li>Predicated - ensures that only elements that are valid according to a predicate can be added</li>
|
|
||||||
<li>Typed - ensures that only elements that are of a specific type can be added</li>
|
|
||||||
<li>Transformed - transforms each element added</li>
|
|
||||||
<li>FixedSize - ensures that the size of the list cannot change</li>
|
|
||||||
<li>Lazy - creates objects in the list on demand</li>
|
|
||||||
<li>Growth - grows the list instead of erroring when set/add used with index beyond the list size</li>
|
|
||||||
<li>SetUnique - a list that avoids duplicate entries like a Set</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
</BODY>
|
|
Loading…
Reference in New Issue