Android Open Source - OpenGL-Sample-Android Circular Iterator






From Project

Back to project page OpenGL-Sample-Android.

License

The source code is released under:

GNU General Public License

If you think the Android project OpenGL-Sample-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.soft.wz.sample.utils;
/*from   w  ww.  ja  v  a2  s  .  c o  m*/
import java.util.Iterator;
import java.util.List;

/**
 * Created by wz on 01/10/2015.
 */
public class CircularIterator<E> implements Iterator<E> {

    private List<E> list;
    private int index = -1;

    public CircularIterator(List<E> list) {
        this.list = list;
    }

    @Override
    public boolean hasNext() {
        return true;
    }

    @Override
    public E next() {
        if (++index > (list.size() - 1)) {
            index = 0;
        }
        return list.get(index);
    }

    @Override
    public void remove() {
        list.remove(index);
    }
}




Java Source Code List

com.soft.wz.sample.BasicRenderer.java
com.soft.wz.sample.MainActivity.java
com.soft.wz.sample.RenderView.java
com.soft.wz.sample.primitives.Circle.java
com.soft.wz.sample.primitives.Colors.java
com.soft.wz.sample.primitives.Cube.java
com.soft.wz.sample.primitives.Shape.java
com.soft.wz.sample.utils.CircularIterator.java
com.soft.wz.sample.utils.GlHelper.java