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

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

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

origin: apache/sis

/**
 * Invoked by JAXB {@link javax.xml.bind.Marshaller} before this object is marshalled to XML.
 * This method sets the locale to be used for XML marshalling to the metadata language.
 */
@SuppressWarnings("unused")
private void beforeMarshal(final Marshaller marshaller) {
  Context.push(CollectionsExt.first(languages));
}
origin: org.apache.sis.core/sis-referencing

/**
 * Returns the "main" namespace of the given factory, or {@code null} if none.
 * Current implementation returns the first namespace, but this may be changed in any future SIS version.
 *
 * <p>The purpose of this method is to get a unique identifier of a factory, ignoring version number.</p>
 */
static String getCodeSpace(final AuthorityFactory factory) {
  return CollectionsExt.first(getCodeSpaces(factory));
}
origin: apache/sis

/**
 * Returns the "main" namespace of the given factory, or {@code null} if none.
 * Current implementation returns the first namespace, but this may be changed in any future SIS version.
 *
 * <p>The purpose of this method is to get a unique identifier of a factory, ignoring version number.</p>
 */
static String getCodeSpace(final AuthorityFactory factory) {
  return CollectionsExt.first(getCodeSpaces(factory));
}
origin: org.apache.sis.core/sis-metadata

/**
 * Invoked by JAXB {@link javax.xml.bind.Marshaller} before this object is marshalled to XML.
 * This method sets the locale to be used for XML marshalling to the metadata language.
 */
private void beforeMarshal(final Marshaller marshaller) {
  Context.push(CollectionsExt.first(languages));
}
origin: apache/sis

/**
 * Gets the default locale for this record (used in ISO 19115-3 format).
 */
@XmlElement(name = "defaultLocale")
private Locale getDefaultLocale() {
  return FilterByVersion.CURRENT_METADATA.accept() ? CollectionsExt.first(getLanguages()) : null;
}
origin: apache/sis

/**
 * Gets the default locale for this record (used in ISO 19115-3 format).
 */
@XmlElement(name = "defaultLocale")
private Locale getDefaultLocale() {
  return FilterByVersion.CURRENT_METADATA.accept() ? CollectionsExt.first(getLanguages()) : null;
}
origin: org.apache.sis.core/sis-metadata

/**
 * Returns the default language used for documenting metadata.
 *
 * @return language used for documenting metadata, or {@code null}.
 *
 * @deprecated As of GeoAPI 3.1, replaced by {@link #getLanguages()}.
 */
@Override
@Deprecated
@XmlElement(name = "language")
@Dependencies("getLanguages")
public Locale getLanguage() {
  return CollectionsExt.first(getLanguages());
  /*
   * No warning if the collection contains more than one locale, because
   * this is allowed by the "getLanguage() + getLocales()" contract.
   */
}
origin: apache/sis

/**
 * Sets the other locales for this record (used in ISO 19115-3 format).
 */
private void setOtherLocales(final Collection<? extends Locale> newValues) {
  setLanguages(OtherLocales.merge(CollectionsExt.first(languages), newValues));
}
origin: org.apache.sis.core/sis-metadata

switch (collection.size()) {
  case 0:  collection = Collections.emptySet(); break;
  case 1:  collection = Collections.singleton(CollectionsExt.first(collection)); break;
  default: collection = Collections.unmodifiableSet(new LinkedHashSet<>(collection)); break;
origin: apache/sis

switch (collection.size()) {
  case 0:  collection = Collections.emptySet(); break;
  case 1:  collection = Collections.singleton(CollectionsExt.first(collection)); break;
  default: collection = Collections.unmodifiableSet(new LinkedHashSet<>(collection)); break;
origin: org.apache.sis.core/sis-metadata

/**
 * Sets information about an alternatively used localized character string for a linguistic extension.
 *
 * @param  newValues  the new locales.
 *
 * @deprecated As of GeoAPI 3.1, replaced by {@link #setLanguages(Collection)}.
 */
@Deprecated
public void setLocales(final Collection<? extends Locale> newValues) {
  checkWritePermission();
  setLanguages(OtherLocales.merge(CollectionsExt.first(languages), newValues)); // See "Note about deprecated methods implementation"
}
origin: apache/sis

/**
 * Returns the default language used for documenting metadata.
 *
 * @return language used for documenting metadata, or {@code null}.
 *
 * @deprecated As of SIS 0.5, replaced by {@link #getLanguages()}.
 */
@Override
@Deprecated
@Dependencies("getLanguages")
@XmlElement(name = "language", namespace = LegacyNamespaces.GMD)
@XmlJavaTypeAdapter(LocaleAdapter.class)
public Locale getLanguage() {
  return FilterByVersion.LEGACY_METADATA.accept() ? CollectionsExt.first(getLanguages()) : null;
  /*
   * No warning if the collection contains more than one locale, because
   * this is allowed by the "getLanguage() + getLocales()" contract.
   */
}
origin: apache/sis

/**
 * If the given property is a link, returns the name of the referenced property.
 * Otherwise returns {@code null}.
 *
 * @param  property  the property to test, or {@code null} if none.
 * @return the referenced property name, or {@code null} if none.
 */
static String linkOf(final AbstractIdentifiedType property) {
  if (property instanceof AbstractOperation) {
    final AbstractOperation op = (AbstractOperation) property;
    if (op.getParameters() == LINK_PARAMS) {
      /*
       * The dependencies collection contains exactly one element on Apache SIS implementation.
       * However the user could define his own operation with the same parameter descriptor name.
       * This is unlikely since it would probably be a bug, but we are paranoiac.
       */
      return CollectionsExt.first(op.getDependencies());
    }
  }
  return null;
}
origin: org.apache.sis.core/sis-feature

  /**
   * If the given property is a link, returns the name of the referenced property.
   * Otherwise returns {@code null}.
   *
   * @param  property  the property to test, or {@code null} if none.
   * @return the referenced property name, or {@code null} if none.
   */
  static String linkOf(final AbstractIdentifiedType property) {
    if (property instanceof AbstractOperation) {
      final AbstractOperation op = (AbstractOperation) property;
      if (op.getParameters() == LINK_PARAMS) {
        /*
         * The dependencies collection contains exactly one element on Apache SIS implementation.
         * However the user could define his own operation with the same parameter descriptor name.
         * This is unlikely since it would probably be a bug, but we are paranoiac.
         */
        return CollectionsExt.first(op.getDependencies());
      }
    }
    return null;
  }
}
origin: org.apache.sis.core/sis-referencing

GenericName name = first(wkt.getAlias());
if (name == null) {
origin: apache/sis

GenericName name = first(wkt.getAlias());
if (name == null) {
origin: org.apache.sis.core/sis-metadata

checkWritePermission();
AbstractIdentification firstId = AbstractIdentification.castOrCopy(CollectionsExt.first(info));
if (firstId == null) {
  firstId = new DefaultDataIdentification();
DefaultOnlineResource firstOnline = DefaultOnlineResource.castOrCopy(CollectionsExt.first(onlineResources));
if (firstOnline == null) {
  firstOnline = new DefaultOnlineResource();
origin: apache/sis

AbstractIdentification firstId = AbstractIdentification.castOrCopy(CollectionsExt.first(info));
if (firstId == null) {
  firstId = new DefaultDataIdentification();
DefaultOnlineResource firstOnline = DefaultOnlineResource.castOrCopy(CollectionsExt.first(onlineResources));
if (firstOnline == null) {
  firstOnline = new DefaultOnlineResource();
origin: apache/sis

final InternationalString expectedAltTitle = first(fromDB.getAlternateTitles());
final InternationalString actualAltTitle   = first(fromFB.getAlternateTitles());
if (fromFB.getTitle().equals(expectedAltTitle)) {
  assertNull(name, actualAltTitle);
final Identifier expectedID = first(fromDB.getIdentifiers());
final Identifier actualID   = first(fromFB.getIdentifiers());
if (expectedID == null) {
  assertNull(name, actualID);
final ResponsibleParty expectedResp = first(fromDB.getCitedResponsibleParties());
final ResponsibleParty actualResp   = first(fromFB.getCitedResponsibleParties());
if (expectedResp == null) {
  assertNull(name, actualResp);
assertEquals(name, first(fromDB.getPresentationForms()),
          first(fromFB.getPresentationForms()));
origin: apache/sis

final ResponsibleParty re = CollectionsExt.first(original.getCitedResponsibleParties());
final ResponsibleParty ra = CollectionsExt.first(clone   .getCitedResponsibleParties());
assertNotSame("citedResponsibleParty", re, ra);
assertSame("role", re.getRole(), ra.getRole());
org.apache.sis.internal.utilCollectionsExtfirst

Javadoc

Returns the first element of the given iterable, or null if none. This method does not emit warning if more than one element is found. Consequently, this method should be used only when multi-occurrence is not ambiguous.

This method is null-safe. Note however that the first element may be null.

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 map. This method is similar to #unmodifiableOrCop
  • 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
  • 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

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for WebStorm
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