@Test public void testEnumeration() { final String[] a = new String[] {"a", "b", "c"}; final Enumeration<String> enumeration = SpecialAgentUtil.enumeration(a); int i = 0; while (enumeration.hasMoreElements()) assertEquals(a[i++], enumeration.nextElement()); assertEquals(a.length, i); }
public static <T>Enumeration<T> enumeration(final T[] a) { return new Enumeration<T>() { private int i = -1; private final int len = a.length - 1; @Override public boolean hasMoreElements() { return i < len; } @Override public T nextElement() { return a[++i]; } }; }
SpecialAgentUtil { public static <T>Enumeration<T> enumeration(final T[] a) { return new Enumeration<T>() { private int i = -1; private final int len = a.length - 1; @Override public boolean hasMoreElements() { return i < len; } @Override public T nextElement() { return a[++i]; } }; } }
SpecialAgentUtil { public static <T>Enumeration<T> enumeration(final T[] a) { return new Enumeration<T>() { private int i = -1; private final int len = a.length - 1; @Override public boolean hasMoreElements() { return i < len; } @Override public T nextElement() { return a[++i]; } }; } private  SpecialAgentUtil(); }
SpecialAgentUtil { public static <T>Enumeration<T> enumeration(final T[] a) { return new Enumeration<T>() { private int i = -1; private final int len = a.length - 1; @Override public boolean hasMoreElements() { return i < len; } @Override public T nextElement() { return a[++i]; } }; } private  SpecialAgentUtil(); static Enumeration<T> enumeration(final T[] a); }
SpecialAgentUtil { public static <T>Enumeration<T> enumeration(final T[] a) { return new Enumeration<T>() { private int i = -1; private final int len = a.length - 1; @Override public boolean hasMoreElements() { return i < len; } @Override public T nextElement() { return a[++i]; } }; } private  SpecialAgentUtil(); static Enumeration<T> enumeration(final T[] a);  }