com.googlecode.bspi.ProviderIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of backport-spi Show documentation
Show all versions of backport-spi Show documentation
The backport-spi library is backport of Service Provider Interface to Java5 with extra features.
/*
* Copyright 2010 The backport-spi Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.googlecode.bspi;
import java.util.Iterator;
import java.util.Map.Entry;
/**
*
*
* @version $Id: ProviderIterator.java 3 2010-07-24 18:40:40Z simone.tripodi $
* @param
*/
final class ProviderIterator implements Iterator {
private final Iterator> knownProviders;
private final ServiceIterator serviceIterator;
public ProviderIterator(Iterator> knownProviders,
ServiceIterator serviceIterator) {
this.knownProviders = knownProviders;
this.serviceIterator = serviceIterator;
}
public boolean hasNext() {
if (this.knownProviders.hasNext()) {
return true;
}
return this.serviceIterator.hasNext();
}
public S next() {
if (this.knownProviders.hasNext()) {
return this.knownProviders.next().getValue();
}
return this.serviceIterator.next();
}
public void remove() {
throw new UnsupportedOperationException();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy