diff -r e576535359cc -r 4019fb4fb1fb jdk/test/java/util/Collections/EmptyIterator.java --- a/jdk/test/java/util/Collections/EmptyIterator.java Thu Oct 30 07:31:41 2014 -0700 +++ b/jdk/test/java/util/Collections/EmptyIterator.java Sat Dec 13 20:22:21 2014 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,40 +33,35 @@ public class EmptyIterator { void test(String[] args) throws Throwable { - testEmptyCollection(Collections.emptyList()); - testEmptyCollection(Collections.emptySet()); + testEmptyCollection(emptyList()); + testEmptyCollection(emptySet()); - testEmptyMap(Collections.emptyMap()); + testEmptyMap(emptyMap()); - Hashtable emptyTable = new Hashtable(); + Hashtable emptyTable = new Hashtable<>(); testEmptyEnumeration(emptyTable.keys()); testEmptyEnumeration(emptyTable.elements()); testEmptyIterator(emptyTable.keySet().iterator()); testEmptyIterator(emptyTable.values().iterator()); testEmptyIterator(emptyTable.entrySet().iterator()); - final Enumeration finalEmptyTyped = - Collections.emptyEnumeration(); + final Enumeration finalEmptyTyped = emptyEnumeration(); testEmptyEnumeration(finalEmptyTyped); - final Enumeration finalEmptyAbstract = - Collections.emptyEnumeration(); + final Enumeration finalEmptyAbstract = emptyEnumeration(); testEmptyEnumeration(finalEmptyAbstract); - @SuppressWarnings("unchecked") Iterator x = - new sun.tools.java.MethodSet() - .lookupName(sun.tools.java.Identifier.lookup("")); - testEmptyIterator(x); + testEmptyIterator(emptyIterator()); } - void testEmptyEnumeration(final Enumeration e) { + void testEmptyEnumeration(final Enumeration e) { check(e == emptyEnumeration()); - check(! e.hasMoreElements()); + check(!e.hasMoreElements()); THROWS(NoSuchElementException.class, new F(){void f(){ e.nextElement(); }}); } - void testEmptyIterator(final Iterator it) { + void testEmptyIterator(final Iterator it) { check(it == emptyIterator()); check(! it.hasNext()); THROWS(NoSuchElementException.class, @@ -75,10 +70,10 @@ new F(){void f(){ it.remove(); }}); } - void testEmptyMap(Map m) { + void testEmptyMap(Map m) { check(m == emptyMap()); check(m.entrySet().iterator() == - Collections.>emptyIterator()); + Collections.>emptyIterator()); check(m.values().iterator() == emptyIterator()); check(m.keySet().iterator() == emptyIterator()); equal(m, unmodifiableMap(m)); @@ -88,7 +83,7 @@ testEmptyCollection(m.values()); } - void testToArray(final Collection c) { + void testToArray(final Collection c) { Object[] a = c.toArray(); equal(a.length, 0); equal(a.getClass().getComponentType(), Object.class); @@ -109,7 +104,7 @@ } } - void testEmptyCollection(final Collection c) { + void testEmptyCollection(final Collection c) { testEmptyIterator(c.iterator()); check(c.iterator() == emptyIterator());