Tabnine Logo
CollectionsExt.filter
Code IndexAdd Tabnine to your IDE (free)

How to use
filter
method
in
org.apache.sis.internal.util.CollectionsExt

Best Java code snippets using org.apache.sis.internal.util.CollectionsExt.filter (Showing top 3 results out of 315)

origin: apache/sis

/**
 * Returns some map projection methods supported by {@literal Proj.4}.
 * Current implementation can not return the complete list of Proj.4 method, but returns the main ones.
 * For each operation method in the returned set, the Proj.4 projection name can be obtained as below:
 *
 * {@preformat java
 *     String proj = IdentifiedObjects.getName(method, Citations.PROJ4);
 * }
 *
 * The {@code proj} names obtained as above can be given in argument to the
 * {@link #getOperationMethod(String)} and {@link #getDefaultParameters(String)} methods.
 *
 * @param  type <code>{@linkplain SingleOperation}.class</code> for fetching all operation methods, or
 *              <code>{@linkplain Projection}.class</code> for fetching only map projection methods.
 * @return methods available in this factory for coordinate operations of the given type.
 *
 * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getAvailableMethods(Class)
 */
public Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type) {
  return new LazySet<>(CollectionsExt.filter(mtFactory.getAvailableMethods(type).iterator(), Proj4Factory::isSupported));
}
origin: org.apache.sis.storage/sis-gdal

/**
 * Returns some map projection methods supported by {@literal Proj.4}.
 * Current implementation can not return the complete list of Proj.4 method, but returns the main ones.
 * For each operation method in the returned set, the Proj.4 projection name can be obtained as below:
 *
 * {@preformat java
 *     String proj = IdentifiedObjects.getName(method, Citations.PROJ4);
 * }
 *
 * The {@code proj} names obtained as above can be given in argument to the
 * {@link #getOperationMethod(String)} and {@link #getDefaultParameters(String)} methods.
 *
 * @param  type <code>{@linkplain SingleOperation}.class</code> for fetching all operation methods, or
 *              <code>{@linkplain Projection}.class</code> for fetching only map projection methods.
 * @return methods available in this factory for coordinate operations of the given type.
 *
 * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getAvailableMethods(Class)
 */
public Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type) {
  return new LazySet<>(CollectionsExt.filter(mtFactory.getAvailableMethods(type).iterator(), new Predicate<IdentifiedObject>() {
    @Override public boolean test(final IdentifiedObject method) {
      return isSupported(method);
    }
  }));
}
origin: apache/sis

/**
 * Tests {@link CollectionsExt#filter(Iterator, Predicate)}.
 */
@Test
public void testFilter() {
  final Iterator<Integer> it = CollectionsExt.filter(Arrays.asList(2, 5, 7, 4, 8).iterator(), (Integer n) -> (n & 1) == 0);
  assertTrue  (   it.hasNext());
  assertEquals(2, it.next().intValue());
  assertEquals(4, it.next().intValue());
  assertTrue  (   it.hasNext());
  assertTrue  (   it.hasNext());
  assertEquals(8, it.next().intValue());
  assertFalse (   it.hasNext());
}
org.apache.sis.internal.utilCollectionsExtfilter

Javadoc

Returns an iterator over the elements of the given iterator where the predicate returns true. The iterator may return null elements.

Popular methods of CollectionsExt

  • singletonOrEmpty
    Returns the given value as a singleton if non-null, or returns an empty set otherwise.
  • unmodifiableOrCopy
    Returns a unmodifiable version of the given set. This method is different than the standard Collecti
  • addToMultiValuesMap
    Adds a value in a pseudo multi-values map. The multi-values map is simulated by a map of lists. The
  • compact
    Returns a more compact representation of the given set. This method is similar to #unmodifiableOrCop
  • first
    Returns the first element of the given iterable, or null if none. This method does not emit warning
  • immutableSet
    Returns the specified array as an immutable set, or null if the array is null. If the given array co
  • toArray
    Returns the elements of the given collection as an array. This method can be used when the valueClas
  • nonNull
    Returns the given set, or Collections#EMPTY_SET if the given set is null.
  • createSetForType
    Creates an initially empty set for elements of the given type. This method will creates specialized
  • emptySortedSet
    Returns a SortedSet which is always empty and accepts no element.Note: This method exists only on th
  • identityEquals
    Returns true if the next elements returned by the given iterators are the same. This method compares
  • modifiableCopy
    Copies the content of the given map to a new unsynchronized, modifiable, in-memory map. The implemen
  • identityEquals,
  • modifiableCopy,
  • nonNullArraySet,
  • removeFromMultiValuesMap,
  • toCaseInsensitiveNameMap,
  • toCollection,
  • empty,
  • emptyQueue,
  • nonEmpty

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top 12 Jupyter Notebook extensions
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