Tabnine Logo
Collection.spliterator
Code IndexAdd Tabnine to your IDE (free)

How to use
spliterator
method
in
java.util.Collection

Best Java code snippets using java.util.Collection.spliterator (Showing top 20 results out of 378)

origin: google/guava

@Override
public Spliterator<E> spliterator() {
 synchronized (mutex) {
  return delegate().spliterator();
 }
}
origin: google/guava

@Override
public Spliterator<K> spliterator() {
 return CollectSpliterators.map(multimap.entries().spliterator(), Map.Entry::getKey);
}
origin: google/guava

@Override
public Spliterator<E> spliterator() {
 return CollectSpliterators.filter(unfiltered.spliterator(), predicate);
}
origin: google/guava

@Override
public Spliterator<T> spliterator() {
 return CollectSpliterators.map(fromCollection.spliterator(), function);
}
origin: prestodb/presto

@Override
public Spliterator<E> spliterator() {
 synchronized (mutex) {
  return delegate().spliterator();
 }
}
origin: prestodb/presto

@Override
public Spliterator<E> spliterator() {
 return CollectSpliterators.filter(unfiltered.spliterator(), predicate);
}
origin: prestodb/presto

@Override
public Spliterator<T> spliterator() {
 return CollectSpliterators.map(fromCollection.spliterator(), function);
}
origin: google/guava

@Override
Spliterator<V> valueSpliterator() {
 return CollectSpliterators.flatMap(
   map.values().spliterator(), Collection::spliterator, Spliterator.SIZED, size());
}
origin: google/guava

@Override
Spliterator<Entry<K, V>> entrySpliterator() {
 return CollectSpliterators.flatMap(
   map.entrySet().spliterator(),
   keyToValueCollectionEntry -> {
    K key = keyToValueCollectionEntry.getKey();
    Collection<V> valueCollection = keyToValueCollectionEntry.getValue();
    return CollectSpliterators.map(
      valueCollection.spliterator(), (V value) -> Maps.immutableEntry(key, value));
   },
   Spliterator.SIZED,
   size());
}
origin: google/guava

@Override
Spliterator<Entry<K, V>> entrySpliterator() {
 return CollectSpliterators.flatMap(
   asMap().entrySet().spliterator(),
   keyToValueCollectionEntry -> {
    K key = keyToValueCollectionEntry.getKey();
    Collection<V> valueCollection = keyToValueCollectionEntry.getValue();
    return CollectSpliterators.map(
      valueCollection.spliterator(), (V value) -> Maps.immutableEntry(key, value));
   },
   Spliterator.SIZED | (this instanceof SetMultimap ? Spliterator.DISTINCT : 0),
   size());
}
origin: prestodb/presto

@Override
Spliterator<V> valueSpliterator() {
 return CollectSpliterators.flatMap(
   map.values().spliterator(), Collection::spliterator, Spliterator.SIZED, size());
}
origin: google/guava

@CollectionFeature.Require(SUPPORTS_ADD)
public void testSpliteratorNotImmutable_CollectionAllowsAdd() {
 // If add is supported, verify that IMMUTABLE is not reported.
 synchronized (collection) { // for Collections.synchronized
  assertFalse(collection.spliterator().hasCharacteristics(Spliterator.IMMUTABLE));
 }
}
origin: prestodb/presto

@Override
public Spliterator<K> spliterator() {
 return CollectSpliterators.map(multimap.entries().spliterator(), Map.Entry::getKey);
}
origin: google/guava

@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testSpliteratorNotImmutable_CollectionAllowsRemove() {
 // If remove is supported, verify that IMMUTABLE is not reported.
 synchronized (collection) { // for Collections.synchronized
  assertFalse(collection.spliterator().hasCharacteristics(Spliterator.IMMUTABLE));
 }
}
origin: prestodb/presto

@Override
Spliterator<Entry<K, V>> entrySpliterator() {
 return CollectSpliterators.flatMap(
   map.entrySet().spliterator(),
   keyToValueCollectionEntry -> {
    K key = keyToValueCollectionEntry.getKey();
    Collection<V> valueCollection = keyToValueCollectionEntry.getValue();
    return CollectSpliterators.map(
      valueCollection.spliterator(), (V value) -> Maps.immutableEntry(key, value));
   },
   Spliterator.SIZED,
   size());
}
origin: google/guava

public void testEntriesSpliterator() {
 List<Entry<String, Integer>> expectedEntries =
   asList(
     Maps.immutableEntry("foo", 2),
     Maps.immutableEntry("foo", 3),
     Maps.immutableEntry("bar", 4),
     Maps.immutableEntry("bar", 5),
     Maps.immutableEntry("foo", 6));
 Multimap<String, Integer> multimap = LinkedHashMultimap.create();
 for (Entry<String, Integer> entry : expectedEntries) {
  multimap.put(entry.getKey(), entry.getValue());
 }
 List<Entry<String, Integer>> actualEntries = new ArrayList<>();
 multimap.entries().spliterator().forEachRemaining(actualEntries::add);
 assertThat(actualEntries).containsExactlyElementsIn(expectedEntries).inOrder();
}
origin: google/guava

 public void testValuesSpliterator() {
  List<Entry<String, Integer>> expectedEntries =
    asList(
      Maps.immutableEntry("foo", 2),
      Maps.immutableEntry("foo", 3),
      Maps.immutableEntry("bar", 4),
      Maps.immutableEntry("bar", 5),
      Maps.immutableEntry("foo", 6));
  Multimap<String, Integer> multimap = LinkedHashMultimap.create();
  for (Entry<String, Integer> entry : expectedEntries) {
   multimap.put(entry.getKey(), entry.getValue());
  }
  List<Integer> actualValues = new ArrayList<>();
  multimap.values().spliterator().forEachRemaining(actualValues::add);
  assertThat(actualValues)
    .containsExactlyElementsIn(Lists.transform(expectedEntries, Entry::getValue))
    .inOrder();
 }
}
origin: google/guava

@CollectionFeature.Require(ALLOWS_NULL_VALUES)
@CollectionSize.Require(absent = ZERO)
public void testSpliteratorNullable() {
 initCollectionWithNullElement();
 synchronized (collection) { // for Collections.synchronized
  assertFalse(collection.spliterator().hasCharacteristics(Spliterator.NONNULL));
 }
}
origin: prestodb/presto

@Override
Spliterator<Entry<K, V>> entrySpliterator() {
 return CollectSpliterators.flatMap(
   asMap().entrySet().spliterator(),
   keyToValueCollectionEntry -> {
    K key = keyToValueCollectionEntry.getKey();
    Collection<V> valueCollection = keyToValueCollectionEntry.getValue();
    return CollectSpliterators.map(
      valueCollection.spliterator(), (V value) -> Maps.immutableEntry(key, value));
   },
   Spliterator.SIZED | (this instanceof SetMultimap ? Spliterator.DISTINCT : 0),
   size());
}
origin: ben-manes/caffeine

@CacheSpec
@CheckNoWriter @CheckNoStats
@Test(dataProvider = "caches")
public void valueSpliterator_tryAdvance(Map<Integer, Integer> map, CacheContext context) {
 Spliterator<Integer> spliterator = map.values().spliterator();
 int[] count = new int[1];
 boolean advanced;
 do {
  advanced = spliterator.tryAdvance(value -> count[0]++);
 } while (advanced);
 assertThat(count[0], is(map.size()));
}
java.utilCollectionspliterator

Popular methods of Collection

  • size
    Returns the number of elements in this collection. If this collection contains more than Integer.MAX
  • iterator
    Returns an iterator over the elements in this collection. There are no guarantees concerning the ord
  • add
  • isEmpty
    Returns true if this collection contains no elements.
  • contains
  • toArray
  • stream
  • addAll
  • forEach
  • remove
  • clear
  • removeAll
  • clear,
  • removeAll,
  • containsAll,
  • equals,
  • hashCode,
  • retainAll,
  • removeIf,
  • parallelStream,
  • <init>

Popular in Java

  • Making http requests using okhttp
  • getExternalFilesDir (Context)
  • getResourceAsStream (ClassLoader)
  • setScale (BigDecimal)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JCheckBox (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now