fixed List growing issue.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130705 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2dd5130b2c
commit
26fbf88577
src/java/org/apache/commons/collections
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/LazyCollections.java,v 1.1 2002/05/29 02:57:41 arron Exp $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2002/05/29 02:57:41 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/LazyCollections.java,v 1.2 2002/05/29 03:22:42 arron Exp $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2002/05/29 03:22:42 $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -81,7 +81,7 @@ import java.lang.reflect.*;
|
|||
* @see org.apache.commons.collections.LazySortedMap
|
||||
*
|
||||
* @author Arron Bates
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public class LazyCollections {
|
||||
|
||||
|
@ -272,8 +272,7 @@ public class LazyCollections {
|
|||
*/
|
||||
public Object get(int index) {
|
||||
Object obj;
|
||||
int size = listImpl.size();
|
||||
if (index < this.listImpl.size()) {
|
||||
if (index < (this.listImpl.size()-1)) {
|
||||
/* within bounds, get the object */
|
||||
obj = this.listImpl.get(index);
|
||||
if (obj == null) {
|
||||
|
@ -287,7 +286,7 @@ public class LazyCollections {
|
|||
}
|
||||
} else {
|
||||
/* we have to grow the list */
|
||||
for (int i = this.listImpl.size(); i < (this.listImpl.size()-1); i++) {
|
||||
for (int i = this.listImpl.size(); i < index; i++) {
|
||||
this.listImpl.add(null);
|
||||
}
|
||||
/* create our last object, set and return */
|
||||
|
|
Loading…
Reference in New Issue