HHH-12686 Replace EmptyIterator with emptyIterator
This commit is contained in:
parent
4c52764c41
commit
5089a818e2
|
@ -33,7 +33,6 @@ import org.hibernate.internal.CoreLogging;
|
|||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.SessionFactoryRegistry;
|
||||
import org.hibernate.internal.util.MarkerObject;
|
||||
import org.hibernate.internal.util.collections.EmptyIterator;
|
||||
import org.hibernate.internal.util.collections.IdentitySet;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
@ -784,7 +783,7 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
|
|||
};
|
||||
}
|
||||
else {
|
||||
return EmptyIterator.INSTANCE;
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.hibernate.hql.spi.QueryTranslatorFactory;
|
|||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.internal.util.collections.EmptyIterator;
|
||||
import org.hibernate.internal.util.collections.IdentitySet;
|
||||
import org.hibernate.internal.util.collections.JoinedIterator;
|
||||
import org.hibernate.query.internal.ParameterMetadataImpl;
|
||||
|
@ -308,7 +307,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
queryParameters.traceParameters( session.getFactory() );
|
||||
}
|
||||
if ( translators.length == 0 ) {
|
||||
return EmptyIterator.INSTANCE;
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
final boolean many = translators.length > 1;
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.internal.util.collections;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
*/
|
||||
public final class EmptyIterator implements Iterator {
|
||||
|
||||
public static final Iterator INSTANCE = new EmptyIterator();
|
||||
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private EmptyIterator() {}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.internal.util.collections;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -76,7 +77,7 @@ public class JoinedIterable<T> implements Iterable<T> {
|
|||
|
||||
if ( currentIterator == null) {
|
||||
if( iterables.size() == 0 ) {
|
||||
currentIterator = EmptyIterator.INSTANCE;
|
||||
currentIterator = Collections.emptyIterator();
|
||||
}
|
||||
else {
|
||||
currentIterator = iterables.get( 0 ).iterator();
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.mapping;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -23,7 +24,6 @@ import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
|||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.internal.FilterConfiguration;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.EmptyIterator;
|
||||
import org.hibernate.internal.util.collections.JoinedIterator;
|
||||
import org.hibernate.internal.util.collections.SingletonIterator;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
@ -888,7 +888,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
|
||||
protected Iterator getDiscriminatorColumnIterator() {
|
||||
return EmptyIterator.INSTANCE;
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
protected void checkColumnDuplication() {
|
||||
|
|
|
@ -59,7 +59,6 @@ import org.hibernate.internal.EmptyScrollableResults;
|
|||
import org.hibernate.internal.EntityManagerMessageLogger;
|
||||
import org.hibernate.internal.HEMLogging;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.internal.util.collections.EmptyIterator;
|
||||
import org.hibernate.jpa.QueryHints;
|
||||
import org.hibernate.jpa.TypedParameterValue;
|
||||
import org.hibernate.jpa.graph.internal.EntityGraphImpl;
|
||||
|
@ -1443,7 +1442,7 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
|
|||
@SuppressWarnings("unchecked")
|
||||
protected Iterator<R> doIterate() {
|
||||
if (getMaxResults() == 0){
|
||||
return EmptyIterator.INSTANCE;
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
return getProducer().iterate(
|
||||
getQueryParameterBindings().expandListValuedParameters( getQueryString(), getProducer() ),
|
||||
|
|
Loading…
Reference in New Issue