File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
freemarker-core/src/main/java/freemarker/core Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -220,8 +220,8 @@ public int getChildCount() {
220220 */
221221 public Enumeration children () {
222222 return childBuffer != null
223- ? new _ArrayEnumeration (childBuffer , childCount )
224- : Collections .enumeration ( Collections . EMPTY_LIST );
223+ ? new _ArrayEnumeration <> (childBuffer , childCount )
224+ : Collections .emptyEnumeration ( );
225225 }
226226
227227 /**
Original file line number Diff line number Diff line change 2323import java .util .NoSuchElementException ;
2424
2525/** Don't use this; used internally by FreeMarker, might change without notice. */
26- public class _ArrayEnumeration implements Enumeration {
26+ public class _ArrayEnumeration < E > implements Enumeration < E > {
2727
28- private final Object [] array ;
28+ private final E [] array ;
2929 private final int size ;
3030 private int nextIndex ;
3131
32- public _ArrayEnumeration (Object [] array , int size ) {
32+ public _ArrayEnumeration (E [] array , int size ) {
3333 this .array = array ;
3434 this .size = size ;
3535 this .nextIndex = 0 ;
@@ -41,7 +41,7 @@ public boolean hasMoreElements() {
4141 }
4242
4343 @ Override
44- public Object nextElement () {
44+ public E nextElement () {
4545 if (nextIndex >= size ) {
4646 throw new NoSuchElementException ();
4747 }
Original file line number Diff line number Diff line change 2323import java .util .NoSuchElementException ;
2424
2525/** Don't use this; used internally by FreeMarker, might change without notice. */
26- public class _ArrayIterator implements Iterator {
26+ public class _ArrayIterator < E > implements Iterator < E > {
2727
28- private final Object [] array ;
28+ private final E [] array ;
2929 private int nextIndex ;
3030
31- public _ArrayIterator (Object [] array ) {
31+ public _ArrayIterator (E [] array ) {
3232 this .array = array ;
3333 this .nextIndex = 0 ;
3434 }
@@ -39,7 +39,7 @@ public boolean hasNext() {
3939 }
4040
4141 @ Override
42- public Object next () {
42+ public E next () {
4343 if (nextIndex >= array .length ) {
4444 throw new NoSuchElementException ();
4545 }
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public boolean contains(Object o) {
4444
4545 @ Override
4646 public Iterator <E > iterator () {
47- return new _ArrayIterator (array );
47+ return new _ArrayIterator <> (array );
4848 }
4949
5050 @ Override
You can’t perform that action at this time.
0 commit comments