Made MappedForeach package private (foreach returns Iterable now) and changed next() to go through the bounds check.
This commit is contained in:
parent
9aafabd728
commit
0033f1cc95
|
@ -38,7 +38,7 @@ import java.util.Iterator;
|
|||
*
|
||||
* @author Riven
|
||||
*/
|
||||
public class MappedForeach<T extends MappedObject> implements Iterable<T> {
|
||||
final class MappedForeach<T extends MappedObject> implements Iterable<T> {
|
||||
|
||||
final T mapped;
|
||||
final int elementCount;
|
||||
|
@ -58,8 +58,7 @@ public class MappedForeach<T extends MappedObject> implements Iterable<T> {
|
|||
}
|
||||
|
||||
public T next() {
|
||||
mapped.viewAddress = mapped.baseAddress + (this.index++) * mapped.stride;
|
||||
|
||||
MappedHelper.put_view(mapped, this.index++);
|
||||
return mapped;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public class MappedObject {
|
|||
* For convenience you are encouraged to static-import this specific method:
|
||||
* <code>import static org.lwjgl.util.mapped.MappedObject.foreach;</code>
|
||||
*/
|
||||
public static <T extends MappedObject> MappedForeach<T> foreach(T mapped, int elementCount) {
|
||||
public static <T extends MappedObject> Iterable<T> foreach(T mapped, int elementCount) {
|
||||
return new MappedForeach<T>(mapped, elementCount);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue