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
|
@ -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 $
|
* $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.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2002/05/29 02:57:41 $
|
* $Date: 2002/05/29 03:22:42 $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -81,7 +81,7 @@ import java.lang.reflect.*;
|
||||||
* @see org.apache.commons.collections.LazySortedMap
|
* @see org.apache.commons.collections.LazySortedMap
|
||||||
*
|
*
|
||||||
* @author Arron Bates
|
* @author Arron Bates
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
public class LazyCollections {
|
public class LazyCollections {
|
||||||
|
|
||||||
|
@ -272,8 +272,7 @@ public class LazyCollections {
|
||||||
*/
|
*/
|
||||||
public Object get(int index) {
|
public Object get(int index) {
|
||||||
Object obj;
|
Object obj;
|
||||||
int size = listImpl.size();
|
if (index < (this.listImpl.size()-1)) {
|
||||||
if (index < this.listImpl.size()) {
|
|
||||||
/* within bounds, get the object */
|
/* within bounds, get the object */
|
||||||
obj = this.listImpl.get(index);
|
obj = this.listImpl.get(index);
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
|
@ -287,7 +286,7 @@ public class LazyCollections {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* we have to grow the list */
|
/* 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);
|
this.listImpl.add(null);
|
||||||
}
|
}
|
||||||
/* create our last object, set and return */
|
/* create our last object, set and return */
|
||||||
|
|
Loading…
Reference in New Issue