当前位置: 首页>>代码示例>>Java>>正文


Java UnmodifiableIterator类代码示例

本文整理汇总了Java中com.google.common.collect.UnmodifiableIterator的典型用法代码示例。如果您正苦于以下问题:Java UnmodifiableIterator类的具体用法?Java UnmodifiableIterator怎么用?Java UnmodifiableIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnmodifiableIterator类属于com.google.common.collect包,在下文中一共展示了UnmodifiableIterator类的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 );
            }
        } );
    }

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:AbstractEventQueryImpl.java

示例2: iterator

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
@Override
public UnmodifiableIterator<E> iterator() {
  final Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator();
  return new AbstractIterator<E>() {
    @Override
    protected E computeNext() {
      while (entries.hasNext()) {
        Entry<E, ?> entry = entries.next();
        if (targetNode.equals(entry.getValue())) {
          return entry.getKey();
        }
      }
      return endOfData();
    }
  };
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:MultiEdgesConnecting.java

示例3: getConcreteIndexAndAliasMetaDatas

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
/**
 * Returns the unique alias metadata per concrete index.
 *
 * (note that although alias can point to the same concrete indices, each alias reference may have its own routing
 * and filters)
 */
public Iterable<Tuple<String, AliasMetaData>> getConcreteIndexAndAliasMetaDatas() {
    return new Iterable<Tuple<String, AliasMetaData>>() {
        @Override
        public Iterator<Tuple<String, AliasMetaData>> iterator() {
            return new UnmodifiableIterator<Tuple<String,AliasMetaData>>() {

                int index = 0;

                @Override
                public boolean hasNext() {
                    return index < referenceIndexMetaDatas.size();
                }

                @Override
                public Tuple<String, AliasMetaData> next() {
                    IndexMetaData indexMetaData = referenceIndexMetaDatas.get(index++);
                    return new Tuple<>(indexMetaData.getIndex(), indexMetaData.getAliases().get(aliasName));
                }

            };
        }
    };
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:30,代码来源:AliasOrIndex.java

示例4: iterator

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
@Override
public Iterator<InetSocketAddress> iterator() {
  return new UnmodifiableIterator<InetSocketAddress>() {
    private final Iterator<Map.Entry<InetAddress,
            Integer>> it = addrs.entries().iterator();

    @Override
    public boolean hasNext() {
      return it.hasNext();
    }

    @Override
    public InetSocketAddress next() {
      Map.Entry<InetAddress, Integer> e = it.next();
      return new InetSocketAddress(e.getKey(), e.getValue());
    }
  };
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:HostFileManager.java

示例5: edges

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
/**
 * An implementation of {@link BaseGraph#edges()} defined in terms of {@link #nodes()} and {@link
 * #successors(Object)}.
 */
@Override
public Set<EndpointPair<N>> edges() {
  return new AbstractSet<EndpointPair<N>>() {
    @Override
    public UnmodifiableIterator<EndpointPair<N>> iterator() {
      return EndpointPairIterator.of(AbstractBaseGraph.this);
    }

    @Override
    public int size() {
      return Ints.saturatedCast(edgeCount());
    }

    @Override
    public boolean contains(@Nullable Object obj) {
      if (!(obj instanceof EndpointPair)) {
        return false;
      }
      EndpointPair<?> endpointPair = (EndpointPair<?>) obj;
      return isDirected() == endpointPair.isOrdered()
          && nodes().contains(endpointPair.nodeU())
          && successors(endpointPair.nodeU()).contains(endpointPair.nodeV());
    }
  };
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:30,代码来源:AbstractBaseGraph.java

示例6: 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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:28,代码来源:NBTUtil.java

示例7: 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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:PotionType.java

示例8: 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();
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:17,代码来源:VisibilityModelState.java

示例9: testListTablesRestricted

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
@Test
public void testListTablesRestricted() {
    final TableOptions options = new TableOptionsBuilder().setPlacement("my:placement").build();
    final ImmutableMap<String, Object> template = ImmutableMap.<String, Object>of("key", "value1");
    final TableAvailability availability = new TableAvailability("my:placement", false);
    final DefaultTable a1 = new DefaultTable("a-table-1", options, template, availability);
    final DefaultTable a2 = new DefaultTable("a-table-2", options, template, availability);
    final DefaultTable b1 = new DefaultTable("b-table-1", options, template, availability);
    final DefaultTable b2 = new DefaultTable("b-table-2", options, template, availability);
    final DefaultTable a3 = new DefaultTable("a-table-3", options, template, availability);
    final ImmutableList<Table> tables = ImmutableList.of(a1, a2, b1, b2, a3);

    final UnmodifiableIterator<Table> iterator = tables.iterator();
    //noinspection unchecked
    when(_server.listTables(null, Long.MAX_VALUE)).thenAnswer(invocation -> iterator);

    {
        final Iterator<Table> tableIterator = sorClient(APIKEY_READ_TABLES_A).listTables(null, 3);
        final ImmutableList<Table> result = ImmutableList.copyOf(tableIterator);
        assertEquals(ImmutableList.<Table>of(a1, a2, a3), result);
    }
    verify(_server, times(1)).listTables(null, Long.MAX_VALUE);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:24,代码来源:DataStoreJerseyTest.java

示例10: 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();
      }
 
开发者ID:Bitterholz,项目名称:LP2,代码行数:20,代码来源:BlockGenericPipe.java

示例11: callable

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
@Provides
Iterable<Callable<Integer>> callable() {
  return new Iterable<Callable<Integer>>() {
    @Override
    public Iterator<Callable<Integer>> iterator() {
      return new UnmodifiableIterator<Callable<Integer>>() {
        @Override
        public boolean hasNext() {
          return true;
        }

        @Override
        public Callable<Integer> next() {
          return new Callable<Integer>() {
            @Override
            public Integer call() throws Exception {
              TimeMeasure.millis(3).sleep();
              return 1;
            }
          };
        }
      };
    }
  };
}
 
开发者ID:immutables,项目名称:miscellaneous,代码行数:26,代码来源:BenchmarkFixture.java

示例12: getItemModels

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
@Override
protected Iterator<IModel<T>> getItemModels(final long offset, final long size) {
	final List<T> list = getModelObject();
	if (list == null) {
		return Collections.emptyIterator();
	}
	
	return new UnmodifiableIterator<IModel<T>>() {
		private int index = (int) offset;
		private final int end = (int) (offset + size);
		
		@Override
		public boolean hasNext() {
			return index < end && index < internalGetItemCount();
		}
		
		@Override
		public IModel<T> next() {
			return newItemModel(index++);
		}
	};
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:23,代码来源:IndexedItemListView.java

示例13: 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()) );
    }
 
开发者ID:williamrubens,项目名称:mossypokerbot,代码行数:18,代码来源:SortedHand.java

示例14: 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()) );
}
 
开发者ID:williamrubens,项目名称:mossypokerbot,代码行数:17,代码来源:UnsortedHand.java

示例15: iterator

import com.google.common.collect.UnmodifiableIterator; //导入依赖的package包/类
@Override
public Iterator<KAFDocument> iterator() {
    return new UnmodifiableIterator<KAFDocument>() {

        private int index = 0;

        @Override
        public boolean hasNext() {
            return this.index < Corpus.this.files.length;
        }

        @Override
        public KAFDocument next() {
            return get(this.index++);
        }

    };
}
 
开发者ID:dkmfbk,项目名称:pikes,代码行数:19,代码来源:Corpus.java


注:本文中的com.google.common.collect.UnmodifiableIterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。