congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.apache.commons.collections4
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.commons.collections4

Best Java code snippets using org.apache.commons.collections4 (Showing top 20 results out of 3,177)

origin: org.apache.commons/commons-collections4

/**
 * Evaluates the predicate returning the result of the decorated predicate
 * once the input has been transformed
 *
 * @param object  the input object which will be transformed
 * @return true if decorated predicate returns true
 */
@Override
public boolean evaluate(final T object) {
  final T result = iTransformer.transform(object);
  return iPredicate.evaluate(result);
}
origin: org.apache.commons/commons-collections4

/**
 * Returns an Enumeration that will enumerate all elements contained
 * in this iterable.
 *
 * @return an Enumeration over the elements of this iterable
 */
public Enumeration<E> asEnumeration() {
  return IteratorUtils.asEnumeration(iterator());
}
origin: org.apache.commons/commons-collections4

/**
 * Returns an array containing all elements of this iterable by traversing
 * its iterator.
 *
 * @param arrayClass  the class of array to create
 * @return an array of the iterable contents
 * @throws ArrayStoreException if arrayClass is invalid
 */
public E[] toArray(final Class<E> arrayClass) {
  return IteratorUtils.toArray(iterator(), arrayClass);
}
origin: Vedenin/useful-java-links

@Benchmark
public long test9_UsingApacheIterableMap() throws IOException {
  long i = 0;
  MapIterator<Integer, Integer> it = iterableMap.mapIterator();
  while (it.hasNext()) {
    i += it.next() + it.getValue();
  }
  return i;
}
origin: org.apache.commons/commons-collections4

/**
 * Gets a new list with the contents of the provided iterable.
 *
 * @param <E> the element type
 * @param iterable  the iterable to use, may be null
 * @return a list of the iterator contents
 */
public static <E> List<E> toList(final Iterable<E> iterable) {
  return IteratorUtils.toList(emptyIteratorIfNull(iterable));
}
origin: org.apache.commons/commons-collections4

/**
 * {@inheritDoc}
 * <p>
 * Note: uses the index for fast lookup
 */
@SuppressWarnings("unchecked")
@Override
public boolean contains(final Object object) {
  return index.containsKey(keyTransformer.transform((C) object));
}
origin: org.apache.commons/commons-collections4

/**
 * Removes an object from the index.
 *
 * @param object the object to remove
 */
private void removeFromIndex(final C object) {
  index.remove(keyTransformer.transform(object));
}
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

/**
 * 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

/**
 * Applies the closure to each element of the provided iterable.
 *
 * @param <E> the element type
 * @param iterable  the iterator to use, may be null
 * @param closure  the closure to apply to each element, may not be null
 * @throws NullPointerException if closure is null
 */
public static <E> void forEach(final Iterable<E> iterable, final Closure<? super E> closure) {
  IteratorUtils.forEach(emptyIteratorIfNull(iterable), closure);
}
origin: org.apache.commons/commons-collections4

@Override
public boolean equals(final Object obj) {
  if (!(obj instanceof EquatorWrapper)) {
    return false;
  }
  @SuppressWarnings("unchecked")
  final EquatorWrapper<O> otherObj = (EquatorWrapper<O>) obj;
  return equator.equate(object, otherObj.getObject());
}
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 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 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 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));
}
org.apache.commons.collections4

Most used classes

  • CollectionUtils
    Provides utility methods and decorators for Collection instances. Various utility methods might put
  • MapUtils
    Provides utility methods and decorators for Map and SortedMap instances. It contains various type sa
  • ListUtils
    Provides utility methods and decorators for List instances.
  • IteratorUtils
    Provides static utility methods and decorators for Iteratorinstances. The implementations are provid
  • LRUMap
    A Map implementation with a fixed maximum size which removes the least recently used entry if an ent
  • MultiValuedMap,
  • CircularFifoQueue,
  • BidiMap,
  • ArrayListValuedHashMap,
  • SetUtils,
  • DualHashBidiMap,
  • HashedMap,
  • Predicate,
  • SetValuedMap,
  • HashSetValuedHashMap,
  • AbstractLinkedMap$LinkEntry,
  • LinkedMap,
  • ListValuedMap,
  • MapIterator
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