Advertisement
tahg

Iterator

Dec 31st, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class MyIterator implements Iterator<BlockPos> {
  2. int xSize,ySize,zSize;
  3. int x,y,z;
  4. BlockPos pos[xSize][ySize][zSize];
  5. private findNext() {
  6. z++;
  7. if (z == zSize) {
  8. z = 0;
  9. y++;
  10. }
  11. if (y == ySize) {
  12. y = 0;
  13. x++;
  14. }
  15. }
  16. public BlockPos next() {
  17. BlockPos ret = pos[x][y][z];
  18. findNext();
  19. return ret;
  20. }
  21. public bool hasNext() {
  22. return x < xSize;
  23. }
  24. public void remove() {
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement