本文整理汇总了Java中com.google.common.collect.UnmodifiableIterator.hasNext方法的典型用法代码示例。如果您正苦于以下问题:Java UnmodifiableIterator.hasNext方法的具体用法?Java UnmodifiableIterator.hasNext怎么用?Java UnmodifiableIterator.hasNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.UnmodifiableIterator
的用法示例。
在下文中一共展示了UnmodifiableIterator.hasNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addListener
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Override
public synchronized void addListener ( final EventListener eventListener )
{
this.listeners.add ( eventListener );
final UnmodifiableIterator<List<Event>> it = Iterators.partition ( AbstractEventQueryImpl.this.events.iterator (), chunkSize );
while ( it.hasNext () )
{
final List<org.eclipse.scada.ae.Event> chunk = it.next ();
this.executor.execute ( new Runnable () {
@Override
public void run ()
{
eventListener.handleEvent ( chunk );
}
} );
}
}
示例2: writeBlockState
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
/**
* Writes the given blockstate to the given tag.
*
* @param tag The tag to write to
* @param state The blockstate to be written
*/
public static NBTTagCompound writeBlockState(NBTTagCompound tag, IBlockState state)
{
tag.setString("Name", ((ResourceLocation)Block.REGISTRY.getNameForObject(state.getBlock())).toString());
if (!state.getProperties().isEmpty())
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
UnmodifiableIterator unmodifiableiterator = state.getProperties().entrySet().iterator();
while (unmodifiableiterator.hasNext())
{
Entry < IProperty<?>, Comparable<? >> entry = (Entry)unmodifiableiterator.next();
IProperty<?> iproperty = (IProperty)entry.getKey();
nbttagcompound.setString(iproperty.getName(), getName(iproperty, (Comparable)entry.getValue()));
}
tag.setTag("Properties", nbttagcompound);
}
return tag;
}
示例3: hasInstantEffect
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
public boolean hasInstantEffect()
{
if (!this.effects.isEmpty())
{
UnmodifiableIterator unmodifiableiterator = this.effects.iterator();
while (unmodifiableiterator.hasNext())
{
PotionEffect potioneffect = (PotionEffect)unmodifiableiterator.next();
if (potioneffect.getPotion().isInstant())
{
return true;
}
}
}
return false;
}
示例4: apply
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Override
public Optional<TRSRTransformation> apply(final Optional<? extends IModelPart> part)
{
if (part.isPresent())
{
final UnmodifiableIterator<String> parts = Models.getParts(part.get());
if (parts.hasNext())
{
final String name = parts.next();
if (!parts.hasNext() && this.blacklist && this.parts.contains(name)
|| !this.blacklist && !this.parts.contains(name))
return this.value;
}
}
return Optional.empty();
}
示例5: apply
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Override
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
if(part.isPresent())
{
// This whole thing is subject to change, but should do for now.
UnmodifiableIterator<String> parts = Models.getParts(part.get());
if(parts.hasNext())
{
String name = parts.next();
// only interested in the root level
if(!parts.hasNext() && hidden.contains(name))
{
return value;
}
}
}
return Optional.absent();
}
示例6: testReplacingValueWhenWeTransferExactlyFirstRange
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Test
public void testReplacingValueWhenWeTransferExactlyFirstRange() {
final ImmutableCollection<Range> existingRanges = makeSomeRanges();
final long intendedNumBytesToTransfer = numBytesToTransfer(existingRanges, existingRanges.size());
final long numBytesTransferred = existingRanges.iterator().next().getLength();
final ImmutableCollection<Range> newRanges = RangeHelper.replaceRange(existingRanges, numBytesTransferred, intendedNumBytesToTransfer);
assertEquals(2, newRanges.size());
final UnmodifiableIterator<Range> existingRangesIterator = existingRanges.iterator();
existingRangesIterator.next();
final UnmodifiableIterator<Range> newRangesIterator = newRanges.iterator();
while (existingRangesIterator.hasNext()) {
final Range existingRange = existingRangesIterator.next();
final Range newRange = newRangesIterator.next();
assertEquals(existingRange.getStart(), newRange.getStart());
assertEquals(existingRange.getLength(), newRange.getLength());
}
}
示例7: testReplacingValueWhenWeTransferExactly1st2Ranges
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Test
public void testReplacingValueWhenWeTransferExactly1st2Ranges() {
final ImmutableCollection<Range> existingRanges = makeSomeRanges();
final long intendedNumBytesToTransfer = numBytesToTransfer(existingRanges, existingRanges.size());
final long numBytesTransferred = numBytesToTransfer(existingRanges, 2);
final ImmutableCollection<Range> newRanges = RangeHelper.replaceRange(existingRanges, numBytesTransferred, intendedNumBytesToTransfer);
assertEquals(1, newRanges.size());
final UnmodifiableIterator<Range> existingRangesIterator = existingRanges.iterator();
existingRangesIterator.next();
existingRangesIterator.next();
final UnmodifiableIterator<Range> newRangesIterator = newRanges.iterator();
while (existingRangesIterator.hasNext()) {
final Range existingRange = existingRangesIterator.next();
final Range newRange = newRangesIterator.next();
assertEquals(existingRange.getStart(), newRange.getStart());
assertEquals(existingRange.getLength(), newRange.getLength());
}
}
示例8: testReplacingValueWhenWeTransfer0Bytes
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Test
public void testReplacingValueWhenWeTransfer0Bytes() {
final ImmutableCollection<Range> existingRanges = makeSomeRanges();
final long intendedNumBytesToTransfer = numBytesToTransfer(existingRanges, existingRanges.size());
final long numBytesTransferred = 0;
final ImmutableCollection<Range> newRanges = RangeHelper.replaceRange(existingRanges, numBytesTransferred, intendedNumBytesToTransfer);
assertEquals(3, newRanges.size());
final UnmodifiableIterator<Range> existingRangesIterator = existingRanges.iterator();
final UnmodifiableIterator<Range> newRangesIterator = newRanges.iterator();
while (existingRangesIterator.hasNext()) {
final Range existingRange = existingRangesIterator.next();
final Range newRange = newRangesIterator.next();
assertEquals(existingRange.getStart(), newRange.getStart());
assertEquals(existingRange.getLength(), newRange.getLength());
}
}
示例9: handle
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
private void handle(final BatchStatement batchStmt, final UnmodifiableIterator<T> batchablesIt, final Function<T, ListenableFuture<Statement>> statementFetcher) {
if (batchablesIt.hasNext()) {
final ListenableFuture<Statement> statementFuture = statementFetcher.apply(batchablesIt.next());
Runnable resultHandler = new Runnable() {
@Override
public void run() {
try {
batchStmt.add(statementFuture.get());
handle(batchStmt, batchablesIt, statementFetcher);
} catch (InterruptedException | ExecutionException | RuntimeException e) {
setException(ListenableFutures.unwrapIfNecessary(e));
}
}
};
statementFuture.addListener(resultHandler, MoreExecutors.directExecutor());
} else {
set(batchStmt);
}
}
示例10: compareTo
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
public int compareTo(@Nonnull RelMultipleTrait o) {
final RelCollationImpl that = (RelCollationImpl) o;
final UnmodifiableIterator<RelFieldCollation> iterator =
that.fieldCollations.iterator();
for (RelFieldCollation f : fieldCollations) {
if (!iterator.hasNext()) {
return 1;
}
final RelFieldCollation f2 = iterator.next();
int c = Utilities.compare(f.getFieldIndex(), f2.getFieldIndex());
if (c != 0) {
return c;
}
}
return iterator.hasNext() ? -1 : 0;
}
示例11: tableNames
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
public Collection<String> tableNames() {
// TODO: once we support closing/opening tables change this to concreteIndices()
// and add state info to the TableInfo.
Set<String> tables = new HashSet<>();
tables.addAll(Collections2.filter(Collections2.transform(
Arrays.asList(clusterService.state().metaData().concreteAllOpenIndices()), indexToTableName), tablesFilter));
// Search for partitioned table templates
UnmodifiableIterator<String> templates = clusterService.state().metaData().getTemplates().keysIt();
while (templates.hasNext()) {
String templateName = templates.next();
if (!PartitionName.isPartition(templateName)) {
continue;
}
try {
PartitionName partitionName = PartitionName.fromIndexOrTemplate(templateName);
TableIdent ti = partitionName.tableIdent();
if (schemaName.equalsIgnoreCase(ti.schema())) {
tables.add(ti.name());
}
} catch (IllegalArgumentException e) {
// do nothing
}
}
return tables;
}
示例12: register
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
private static void register(int typeid, String minecraftKey, final Block block) {
Block.REGISTRY.a(typeid, new MinecraftKey(minecraftKey), block);
UnmodifiableIterator<IBlockData> iterable = block.t().a().iterator();
while (iterable.hasNext()) {
IBlockData iblockdata = iterable.next();
int k = Block.REGISTRY.a(block) << 4 | block.toLegacyData(iblockdata);
Block.REGISTRY_ID.a(iblockdata, k);
}
}
示例13: register
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
private static void register(int typeid, String minecraftKey, final Block block) {
Block.REGISTRY.a(typeid, new MinecraftKey(minecraftKey), block);
UnmodifiableIterator<IBlockData> iterable = block.s().a().iterator();
while (iterable.hasNext()) {
IBlockData iblockdata = iterable.next();
int k = Block.REGISTRY.a(block) << 4 | block.toLegacyData(iblockdata);
Block.REGISTRY_ID.a(iblockdata, k);
}
}
示例14: getAllowedValues
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
private List < Iterable < Comparable<? >>> getAllowedValues()
{
List < Iterable < Comparable<? >>> list = Lists. < Iterable < Comparable<? >>> newArrayList();
ImmutableCollection < IProperty<? >> immutablecollection = this.properties.values();
UnmodifiableIterator unmodifiableiterator = immutablecollection.iterator();
while (unmodifiableiterator.hasNext())
{
IProperty<?> iproperty = (IProperty)unmodifiableiterator.next();
list.add(((IProperty)iproperty).getAllowedValues());
}
return list;
}
示例15: buildPropertyValueTable
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
public void buildPropertyValueTable(Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map)
{
if (this.propertyValueTable != null)
{
throw new IllegalStateException();
}
else
{
Table < IProperty<?>, Comparable<?>, IBlockState > table = HashBasedTable. < IProperty<?>, Comparable<?>, IBlockState > create();
UnmodifiableIterator unmodifiableiterator = this.properties.entrySet().iterator();
while (unmodifiableiterator.hasNext())
{
Entry < IProperty<?>, Comparable<? >> entry = (Entry)unmodifiableiterator.next();
IProperty<?> iproperty = (IProperty)entry.getKey();
for (Comparable<?> comparable : iproperty.getAllowedValues())
{
if (comparable != entry.getValue())
{
table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
}
}
}
this.propertyValueTable = ImmutableTable. < IProperty<?>, Comparable<?>, IBlockState > copyOf(table);
}
}