com.google.common.collect.Multiset.iterator()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中com.google.common.collect.Multiset.iterator()方法的一些代码示例,展示了Multiset.iterator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Multiset.iterator()方法的具体详情如下:
包路径:com.google.common.collect.Multiset
类名称:Multiset
方法名:iterator

Multiset.iterator介绍

[英]Elements that occur multiple times in the multiset will appear multiple times in this iterator, though not necessarily sequentially.
[中]在multiset中多次出现的元素将在此迭代器中多次出现,尽管不一定是按顺序出现。

代码示例

代码示例来源:origin: google/guava

@Override
public UnmodifiableIterator<E> iterator() {
 return Iterators.filter(unfiltered.iterator(), predicate);
}

代码示例来源:origin: google/guava

@Override
public Iterator<E> iterator() {
 return Iterators.<E>unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: wildfly/wildfly

@Override
public UnmodifiableIterator<E> iterator() {
 return Iterators.filter(unfiltered.iterator(), predicate);
}

代码示例来源:origin: google/j2objc

@Override
public Iterator<E> iterator() {
 return Iterators.<E>unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: wildfly/wildfly

@Override
public Iterator<E> iterator() {
 return Iterators.<E>unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: google/guava

@Override
protected Iterator<String> newTargetIterator() {
 multimap = LinkedHashMultimap.create();
 multimap.putAll("foo", asList(2, 3));
 multimap.putAll("bar", asList(4, 5));
 multimap.putAll("foo", asList(6));
 return multimap.keys().iterator();
}

代码示例来源:origin: google/guava

@Override
protected Iterator<String> newTargetIterator() {
 multimap = create();
 multimap.putAll("foo", asList(2, 3));
 multimap.putAll("bar", asList(4, 5));
 multimap.putAll("foo", asList(6));
 return multimap.keys().iterator();
}

代码示例来源:origin: google/guava

@CollectionSize.Require(SEVERAL)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
public void testEntryReflectsIteratorRemove() {
 initThreeCopies();
 assertEquals(3, getMultiset().count(e0()));
 Multiset.Entry<E> entry = Iterables.getOnlyElement(getMultiset().entrySet());
 assertEquals(3, entry.getCount());
 Iterator<E> itr = getMultiset().iterator();
 itr.next();
 itr.remove();
 assertEquals(2, entry.getCount());
 itr.next();
 itr.remove();
 itr.next();
 itr.remove();
 assertEquals(0, entry.getCount());
}

代码示例来源:origin: google/guava

@GwtIncompatible // SerializableTester
public void testSerializationContainingSelf() {
 Multiset<Multiset<?>> multiset = HashMultiset.create();
 multiset.add(multiset, 2);
 Multiset<Multiset<?>> copy = SerializableTester.reserialize(multiset);
 assertEquals(2, copy.size());
 assertSame(copy, copy.iterator().next());
}

代码示例来源:origin: google/guava

@GwtIncompatible // SerializableTester
public void testSerializationIndirectSelfReference() {
 Multiset<MultisetHolder> multiset = HashMultiset.create();
 MultisetHolder holder = new MultisetHolder(multiset);
 multiset.add(holder, 2);
 Multiset<MultisetHolder> copy = SerializableTester.reserialize(multiset);
 assertEquals(2, copy.size());
 assertSame(copy, copy.iterator().next().member);
}

代码示例来源:origin: org.apache.mahout/mahout-core

@Override
public Iterator<Vector> iterator() {
 return Iterators.transform(trainingVectors.iterator(), new Function<HashedVector, Vector>() {
  @Override
  public Vector apply(org.apache.mahout.math.neighborhood.HashedVector input) {
   Preconditions.checkNotNull(input);
   //noinspection ConstantConditions
   return input.getVector();
  }
 });
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@SuppressWarnings("unchecked")
@Override public Iterator<E> iterator() {
 // Safe because the returned Iterator is made unmodifiable
 return (Iterator<E>) Iterators.unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: com.google.collections/google-collections

@SuppressWarnings("unchecked")
@Override public Iterator<E> iterator() {
 // Safe because the returned Iterator is made unmodifiable
 return (Iterator) Iterators.unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@SuppressWarnings("unchecked")
@Override public Iterator<E> iterator() {
 // Safe because the returned Iterator is made unmodifiable
 return (Iterator<E>) Iterators.unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: Nextdoor/bender

@SuppressWarnings("unchecked")
@Override public Iterator<E> iterator() {
 // Safe because the returned Iterator is made unmodifiable
 return (Iterator<E>) Iterators.unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava

@SuppressWarnings("unchecked")
@Override public Iterator<E> iterator() {
 // Safe because the returned Iterator is made unmodifiable
 return (Iterator<E>) Iterators.unmodifiableIterator(delegate.iterator());
}

代码示例来源:origin: com.google.gdata/gdata-core-1.0

public Set<GoogleCookie> getCookies() {

  // Lazy flushing of expired cookies
  Iterator<GoogleCookie> cookieIter = cookies.iterator();
  while (cookieIter.hasNext()) {
   GoogleCookie cookie = cookieIter.next();
   if (cookie.hasExpired()) {
    cookieIter.remove();
   }
  }
  return cookies.elementSet();
 }
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

@Override
public AV getSingleElement()
{
  return size() == 1 ? elements().iterator().next() : null;
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

@Override
public AV getSingleElement()
{
  return size() == 1 ? elements().iterator().next() : null;
}

代码示例来源:origin: com.google.guava/guava-tests

@GwtIncompatible // SerializableTester
public void testSerializationIndirectSelfReference() {
 Multiset<MultisetHolder> multiset = HashMultiset.create();
 MultisetHolder holder = new MultisetHolder(multiset);
 multiset.add(holder, 2);
 Multiset<MultisetHolder> copy = SerializableTester.reserialize(multiset);
 assertEquals(2, copy.size());
 assertSame(copy, copy.iterator().next().member);
}

相关文章