1 21 24 package org.lobobrowser.util; 25 26 import java.util.*; 27 28 31 public class ArrayUtilities { 32 33 36 private ArrayUtilities() { 37 super(); 38 } 39 40 public static Iterator iterator(Object [] array, int offset, int length) { 41 return new ArrayIterator(array, offset, length); 42 } 43 44 private static class ArrayIterator implements Iterator { 45 private final Object [] array; 46 private final int top; 47 private int offset; 48 49 public ArrayIterator(Object [] array, int offset, int length) { 50 this.array = array; 51 this.offset = offset; 52 this.top = offset + length; 53 } 54 55 58 public boolean hasNext() { 59 return this.offset < this.top; 60 } 61 62 65 public Object next() { 66 return this.array[this.offset++]; 67 } 68 69 72 public void remove() { 73 throw new UnsupportedOperationException (); 74 } 75 } 76 } 77 | Popular Tags |