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

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

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

origin: apache/sis

/**
 * Tests {@link CollectionsExt#nonNullArraySet(String, Object, Object[])}.
 */
@Test
public void testNonNullArraySet() {
  final String name = "test";
  final String[] emptyArray = new String[0];
  assertSame(emptyArray,
      CollectionsExt.nonNullArraySet(name, null, emptyArray));
  assertSame(emptyArray,
      CollectionsExt.nonNullArraySet(name, emptyArray, emptyArray));
  assertArrayEquals(new String[] {"A"},
      CollectionsExt.nonNullArraySet(name, "A", emptyArray));
  assertArrayEquals(new String[] {"A"},
      CollectionsExt.nonNullArraySet(name, new String[] {"A", null, "A"}, emptyArray));
  assertArrayEquals(new String[] {"B", "A", "C"},
      CollectionsExt.nonNullArraySet(name, new String[] {"B", "A", "B", "C", null, "A"}, emptyArray));
  /*
   * Verify that an exception is thrown in case of illegal value type.  Note that the Object[] type
   * could be accepted if all elements are String instances, however the current method contract is
   * to not accept them, so we will ensure that.
   */
  try {
    CollectionsExt.nonNullArraySet(name, new Object[] {"A"}, emptyArray);
  } catch (IllegalArgumentException e) {
    final String message = e.getMessage();
    assertTrue(message, message.contains(name));
    assertTrue(message, message.contains("Object[]"));
  }
}
origin: apache/sis

this.ellipsoid     = ellipsoid;
this.primeMeridian = primeMeridian;
bursaWolf = CollectionsExt.nonEmpty(CollectionsExt.nonNullArraySet(
    BURSA_WOLF_KEY, properties.get(BURSA_WOLF_KEY), EMPTY_ARRAY));
if (bursaWolf != null) {
origin: org.apache.sis.core/sis-referencing

this.ellipsoid     = ellipsoid;
this.primeMeridian = primeMeridian;
bursaWolf = CollectionsExt.nonEmpty(CollectionsExt.nonNullArraySet(
    BURSA_WOLF_KEY, properties.get(BURSA_WOLF_KEY), EMPTY_ARRAY));
if (bursaWolf != null) {
org.apache.sis.internal.utilCollectionsExtnonNullArraySet

Javadoc

Given a value which is either null, an instance of or an array of , returns a non-null array containing all elements without null and without duplicated values. More specifically:
  • If the given value is null, then this method returns emptyArray.
  • If the given value is an instance of , then this method returns an array of length 1 which contain only value.
  • If the given value is an array of , then this method returns copy of that array, omitting null elements and duplicated elements.
  • Otherwise this method throws IllegalArgumentException.
Note: It would be very easy to add support for value argument of type Object[] or collections. But we do not provide such support for now because this method is used mostly as a helper method for constructors of AbstractIdentifiedObject subclasses receiving a map of properties, and the contract of our constructors do not allow those other types for now.

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
  • filter
    Returns an iterator over the elements of the given iterator where the predicate returns true. The it
  • identityEquals
    Returns true if the next elements returned by the given iterators are the same. This method compares
  • filter,
  • identityEquals,
  • modifiableCopy,
  • removeFromMultiValuesMap,
  • toCaseInsensitiveNameMap,
  • toCollection,
  • empty,
  • emptyQueue,
  • nonEmpty

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • getSupportFragmentManager (FragmentActivity)
  • getExternalFilesDir (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Github Copilot alternatives
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