本文整理汇总了Java中com.google.common.collect.UnmodifiableIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java UnmodifiableIterator.next方法的具体用法?Java UnmodifiableIterator.next怎么用?Java UnmodifiableIterator.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.UnmodifiableIterator
的用法示例。
在下文中一共展示了UnmodifiableIterator.next方法的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: getHighestFiveCardHand
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Override
public IHand getHighestFiveCardHand()
{
// if(cards.size() < 5)
// {
// return this;
// }
// return new Hand(cards.asList().reverse().subList(0,5));
UnmodifiableIterator iter = cards.iterator();
int offset = cards.size() - 5;
while(offset-- > 0)
{
iter.next();
}
return new SortedHand(cards.tailSet((Card)iter.next()) );
}
示例7: getHighestFiveCardHand
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Override
public IHand getHighestFiveCardHand() {
if(cards.size() < 5)
{
return this;
}
ImmutableSortedSet<Card> sortedCards = cardsSorted();
UnmodifiableIterator iter = sortedCards.iterator();
int offset = sortedCards.size() - 5;
while(offset-- > 0)
{
iter.next();
}
return new SortedHand(sortedCards.tailSet((Card)iter.next()) );
}
示例8: testReplacingValueInThirdRange
import com.google.common.collect.UnmodifiableIterator; //导入方法依赖的package包/类
@Test
public void testReplacingValueInThirdRange() {
final ImmutableCollection<Range> existingRanges = makeSomeRanges();
final long intendedNumBytesToTransfer = numBytesToTransfer(existingRanges, existingRanges.size());
final long numBytesTransferred = 27000;
final ImmutableCollection<Range> newRanges = RangeHelper.replaceRange(existingRanges, numBytesTransferred, intendedNumBytesToTransfer);
assertEquals(1, newRanges.size());
final UnmodifiableIterator<Range> existingRangesIterator = existingRanges.iterator();
existingRangesIterator.next();
final long lengthOf2ndRange = existingRangesIterator.next().getLength();
final long expectedStartIn3rdRange = lengthOf2ndRange + numBytesTransferred;
assertEquals(expectedStartIn3rdRange, newRanges.iterator().next().getStart());
assertEquals(existingRangesIterator.next().getEnd(), newRanges.iterator().next().getEnd());
}
示例9: 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());
}
}
示例10: 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());
}
}
示例11: 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());
}
}
示例12: 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;
}
示例13: 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;
}
示例14: 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);
}
}
示例15: 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);
}
}