Tabnine Logo
FluentIterable.of
Code IndexAdd Tabnine to your IDE (free)

How to use
of
method
in
org.apache.commons.collections4.FluentIterable

Best Java code snippets using org.apache.commons.collections4.FluentIterable.of (Showing top 18 results out of 315)

origin: org.apache.commons/commons-collections4

/**
 * Creates a new FluentIterable from the provided elements.
 * <p>
 * The returned iterable's iterator does not support {@code remove()}.
 *
 * @param <T>  the element type
 * @param elements  the elements to be contained in the FluentIterable
 * @return a new FluentIterable containing the provided elements
 */
public static <T> FluentIterable<T> of(final T... elements) {
  return of(Arrays.asList(elements));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will return at most
 * the provided maximum number of elements from this iterable.
 *
 * @param maxSize  the maximum number of elements
 * @return a new iterable, providing a bounded view of this iterable
 * @throws IllegalArgumentException if maxSize is negative
 */
public FluentIterable<E> limit(final long maxSize) {
  return of(IterableUtils.boundedIterable(iterable, maxSize));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will traverse the
 * elements from this iterable in reverse order.
 *
 * @return a new iterable, providing a reversed view of this iterable
 */
public FluentIterable<E> reverse() {
  return of(IterableUtils.reversedIterable(iterable));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will return an unmodifiable
 * view of this iterable.
 *
 * @return a new iterable, providing an unmodifiable view of this iterable
 */
public FluentIterable<E> unmodifiable() {
  return of(IterableUtils.unmodifiableIterable(iterable));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will traverse
 * the elements of this iterable and the other iterable in
 * alternating order.
 *
 * @param other  the other iterable to interleave, may not be null
 * @return a new iterable, interleaving this iterable with others
 * @throws NullPointerException if other is null
 */
public FluentIterable<E> zip(final Iterable<? extends E> other) {
  return of(IterableUtils.zippingIterable(iterable, other));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will first traverse
 * the elements of the current iterable, followed by the elements
 * of the provided iterable.
 *
 * @param other  the other iterable to combine, may not be null
 * @return a new iterable, combining this iterable with other
 * @throws NullPointerException if other is null
 */
public FluentIterable<E> append(final Iterable<? extends E> other) {
  return of(IterableUtils.chainedIterable(iterable, other));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will only return
 * elements from this iterable matching the provided predicate.
 *
 * @param predicate  the predicate used to filter elements
 * @return a new iterable, providing a filtered view of this iterable
 * @throws NullPointerException if predicate is null
 */
public FluentIterable<E> filter(final Predicate<? super E> predicate) {
  return of(IterableUtils.filteredIterable(iterable, predicate));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will skip the first
 * N elements from this iterable.
 *
 * @param elementsToSkip  the number of elements to skip
 * @return a new iterable, providing a view of this iterable by skipping
 *   the first N elements
 * @throws IllegalArgumentException if elementsToSkip is negative
 */
public FluentIterable<E> skip(final long elementsToSkip) {
  return of(IterableUtils.skippingIterable(iterable, elementsToSkip));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will return all elements
 * of this iterable transformed by the provided transformer.
 *
 * @param <O>  the output element type
 * @param transformer  the transformer applied to each element
 * @return a new iterable, providing a transformed view of this iterable
 * @throws NullPointerException if transformer is null
 */
public <O> FluentIterable<O> transform(final Transformer<? super E, ? extends O> transformer) {
  return of(IterableUtils.transformedIterable(iterable, transformer));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will loop infinitely
 * over the elements from this iterable.
 *
 * @return a new iterable, providing a looping view of this iterable
 */
public FluentIterable<E> loop() {
  return of(IterableUtils.loopingIterable(iterable));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will return a unique view
 * of this iterable.
 *
 * @return a new iterable, providing a unique view of this iterable
 */
public FluentIterable<E> unique() {
  return of(IterableUtils.uniqueIterable(iterable));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will traverse
 * the elements of this iterable and the other iterables in
 * alternating order.
 *
 * @param others  the iterables to interleave, may not be null
 * @return a new iterable, interleaving this iterable with others
 * @throws NullPointerException if either of the provided iterables is null
 */
public FluentIterable<E> zip(final Iterable<? extends E>... others) {
  return of(IterableUtils.zippingIterable(iterable, others));
}
origin: org.apache.commons/commons-collections4

/**
 * This method fully traverses an iterator of this iterable and returns
 * a new iterable with the same contents, but without any reference
 * to the originating iterables and/or iterators.
 * <p>
 * Calling this method is equivalent to:
 * <pre>
 *   FluentIterable&lt;E&gt; someIterable = ...;
 *   FluentIterable.of(someIterable.toList());
 * </pre>
 *
 * @return a new iterable with the same contents as this iterable
 */
public FluentIterable<E> eval() {
  return of(toList());
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will traverse the
 * elements of the current and provided iterable according to the
 * ordering defined by an comparator.
 * <p>
 * Example: descending order
 * <ul>
 *   <li>this contains elements [7, 5, 3, 1]
 *   <li>other contains elements [8, 6, 4, 2]
 * </ul>
 * <p>
 * The returned iterable will traverse the elements in the following
 * order: [8, 7, 6, 5, 4, 3, 2, 1]
 *
 * @param comparator  the comparator to define an ordering, may be null,
 *   in which case natural ordering will be used
 * @param other  the other iterable to collate, may not be null
 * @return a new iterable, collating this iterable with the other in natural order
 * @throws NullPointerException if other is null
 * @see org.apache.commons.collections4.iterators.CollatingIterator
 */
public FluentIterable<E> collate(final Iterable<? extends E> other,
                 final Comparator<? super E> comparator) {
  return of(IterableUtils.collatedIterable(comparator, iterable, other));
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a new FluentIterable whose iterator will traverse the
 * elements of the current and provided iterable in natural order.
 * <p>
 * Example: natural ordering
 * <ul>
 *   <li>this contains elements [1, 3, 5, 7]
 *   <li>other contains elements [2, 4, 6, 8]
 * </ul>
 * <p>
 * The returned iterable will traverse the elements in the following
 * order: [1, 2, 3, 4, 5, 6, 7, 8]
 *
 * @param other  the other iterable to collate, may not be null
 * @return a new iterable, collating this iterable with the other in natural order
 * @throws NullPointerException if other is null
 * @see org.apache.commons.collections4.iterators.CollatingIterator
 */
public FluentIterable<E> collate(final Iterable<? extends E> other) {
  return of(IterableUtils.collatedIterable(iterable, other));
}
origin: org.apache.commons/commons-collections4

/**
 * Constructs a new <code>ZippingIterator</code> that will provide
 * interleaved iteration of the specified iterators.
 *
 * @param iterators  the array of iterators
 * @throws NullPointerException if any iterator is null
 */
public ZippingIterator(final Iterator<? extends E>... iterators) {
  // create a mutable list to be able to remove exhausted iterators
  final List<Iterator<? extends E>> list = new ArrayList<>();
  for (final Iterator<? extends E> iterator : iterators) {
    if (iterator == null) {
      throw new NullPointerException("Iterator must not be null.");
    }
    list.add(iterator);
  }
  this.iterators = FluentIterable.of(list).loop().iterator();
}
origin: org.apache.commons/commons-collections4

/**
 * Creates a new FluentIterable of the single provided element.
 * <p>
 * The returned iterable's iterator does not support {@code remove()}.
 *
 * @param <T>  the element type
 * @param singleton  the singleton element
 * @return a new FluentIterable containing the singleton
 */
public static <T> FluentIterable<T> of(final T singleton) {
  return of(IteratorUtils.asIterable(new SingletonIterator<>(singleton, false)));
}
origin: org.apache.commons/commons-collections4

@Override
public boolean putAll(final K key, final Iterable<? extends V> values) {
  if (values == null) {
    throw new NullPointerException("Values must not be null.");
  }
  final Iterable<V> transformedValues = FluentIterable.of(values).transform(valueTransformer);
  final Iterator<? extends V> it = transformedValues.iterator();
  return it.hasNext() && CollectionUtils.addAll(decorated().get(transformKey(key)), it);
}
org.apache.commons.collections4FluentIterableof

Javadoc

Construct a new FluentIterable from the provided iterable. If the iterable is already an instance of FluentIterable, the instance will be returned instead.

The returned iterable's iterator supports remove() when the corresponding input iterator supports it.

Popular methods of FluentIterable

  • toList
    Returns a mutable list containing all elements of this iterable by traversing its iterator. The retu
  • transform
    Returns a new FluentIterable whose iterator will return all elements of this iterable transformed by
  • <init>
    Create a new FluentIterable by wrapping the provided iterable.
  • append
    Returns a new FluentIterable whose iterator will first traverse the elements of the current iterable
  • copyInto
    Traverses an iterator of this iterable and adds all elements to the provided collection.
  • filter
    Returns a new FluentIterable whose iterator will only return elements from this iterable matching th
  • iterator
  • loop
    Returns a new FluentIterable whose iterator will loop infinitely over the elements from this iterabl

Popular in Java

  • Finding current android device location
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • Menu (java.awt)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best plugins for Eclipse
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