Codota Logo
CollectionUtils.nullSafeMap
Code IndexAdd Codota to your IDE (free)

How to use
nullSafeMap
method
in
org.springframework.data.gemfire.util.CollectionUtils

Best Java code snippets using org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.springframework.data/spring-data-gemfire

/**
 * Returns a {@link Map} of application domain object field names to {@link Analyzer Analyzers} used in
 * the construction of the {@link LuceneIndex Lucene Indexes} for each field.
 *
 * @return a {@link Map} of fields names to {@link Analyzer Analyzers}.
 * @see org.apache.lucene.analysis.Analyzer
 * @see java.util.Map
 * @see #getFields()
 */
protected Map<String, Analyzer> getFieldAnalyzers() {
  return nullSafeMap(this.fieldAnalyzers);
}
origin: org.springframework.data/spring-data-geode

/**
 * Returns a {@link Map} of application domain object field names to {@link Analyzer Analyzers} used in
 * the construction of the {@link LuceneIndex Lucene Indexes} for each field.
 *
 * @return a {@link Map} of fields names to {@link Analyzer Analyzers}.
 * @see org.apache.lucene.analysis.Analyzer
 * @see java.util.Map
 * @see #getFields()
 */
protected Map<String, Analyzer> getFieldAnalyzers() {
  return nullSafeMap(this.fieldAnalyzers);
}
origin: org.springframework.data/spring-data-gemfire

/**
 * Determines whether the given {@link Map} is {@link Map#isEmpty() empty}.
 *
 * @param map {@link Map} to evaluate.
 * @return a boolean value indicating whether the given {@link Map} is {@link Map#isEmpty() empty}.
 * @see #nullSafeMap(Map)
 * @see java.util.Map#isEmpty()
 */
public static boolean nullSafeIsEmpty(@Nullable Map<?, ?> map) {
  return nullSafeMap(map).isEmpty();
}
origin: org.springframework.data/spring-data-gemfire

/**
 * Determines the {@link Map#size()} of the given {@link Map}.
 *
 * @param map {@link Map} to evaluate.
 * @return the {@link Map#size()} of the given {@link Map}.
 * @see #nullSafeMap(Map)
 * @see java.util.Map#size()
 */
public static int nullSafeSize(@Nullable Map<?, ?> map) {
  return nullSafeMap(map).size();
}
origin: org.springframework.data/spring-data-geode

/**
 * Determines whether the given {@link Map} is {@link Map#isEmpty() empty}.
 *
 * @param map {@link Map} to evaluate.
 * @return a boolean value indicating whether the given {@link Map} is {@link Map#isEmpty() empty}.
 * @see #nullSafeMap(Map)
 * @see java.util.Map#isEmpty()
 */
public static boolean nullSafeIsEmpty(@Nullable Map<?, ?> map) {
  return nullSafeMap(map).isEmpty();
}
origin: org.springframework.data/spring-data-geode

/**
 * Determines the {@link Map#size()} of the given {@link Map}.
 *
 * @param map {@link Map} to evaluate.
 * @return the {@link Map#size()} of the given {@link Map}.
 * @see #nullSafeMap(Map)
 * @see java.util.Map#size()
 */
public static int nullSafeSize(@Nullable Map<?, ?> map) {
  return nullSafeMap(map).size();
}
origin: org.springframework.data/spring-data-geode

  @NonNull
  private static SortedMap<?, ?> newSortedMap(@Nullable Map<?, ?> map) {
    return new TreeMap<>(nullSafeMap(map));
  }
}
origin: org.springframework.data/spring-data-gemfire

  @NonNull
  private static SortedMap<?, ?> newSortedMap(@Nullable Map<?, ?> map) {
    return new TreeMap<>(nullSafeMap(map));
  }
}
origin: org.springframework.data/spring-data-geode

private List<IndexConfigurer> resolveIndexConfigurers() {
  return Optional.ofNullable(this.indexConfigurers)
    .filter(indexConfigurers -> !indexConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, IndexConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(IndexConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-gemfire

protected List<RegionConfigurer> resolveRegionConfigurers() {
  return Optional.ofNullable(this.regionConfigurers)
    .filter(regionConfigurers -> !regionConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, RegionConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(RegionConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-gemfire

private List<CacheServerConfigurer> resolveCacheServerConfigurers() {
  return Optional.ofNullable(this.cacheServerConfigurers)
    .filter(cacheServerConfigurers -> !cacheServerConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(this.getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(CacheServerConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-geode

private List<PeerCacheConfigurer> resolvePeerCacheConfigurers() {
  return Optional.ofNullable(this.peerCacheConfigurers)
    .filter(peerCacheConfigurers -> !peerCacheConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(this.getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, PeerCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(PeerCacheConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-geode

protected List<ContinuousQueryListenerContainerConfigurer> resolveContinuousQueryListenerContainerConfigurers() {
  return Optional.ofNullable(this.configurers)
    .filter(configurers -> !configurers.isEmpty())
    .orElseGet(() ->
      Optional.of(this.getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, ContinuousQueryListenerContainerConfigurer> beansOfType =
            ((ListableBeanFactory) beanFactory).getBeansOfType(ContinuousQueryListenerContainerConfigurer.class,
              true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-gemfire

private List<PoolConfigurer> resolvePoolConfigurers() {
  return Optional.ofNullable(this.poolConfigurers)
    .filter(poolConfigurers -> !poolConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(this.getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, PoolConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(PoolConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-gemfire

private List<PeerCacheConfigurer> resolvePeerCacheConfigurers() {
  return Optional.ofNullable(this.peerCacheConfigurers)
    .filter(peerCacheConfigurers -> !peerCacheConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(this.getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, PeerCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(PeerCacheConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-gemfire

private List<DiskStoreConfigurer> resolveDiskStoreConfigurers() {
  return Optional.ofNullable(this.diskStoreConfigurers)
    .filter(diskStoreConfigurers -> !diskStoreConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(this.getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, DiskStoreConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(DiskStoreConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-geode

private List<PoolConfigurer> resolvePoolConfigurers() {
  return Optional.ofNullable(this.poolConfigurers)
    .filter(poolConfigurers -> !poolConfigurers.isEmpty())
    .orElseGet(() ->
      Optional.of(this.getBeanFactory())
        .filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
        .map(beanFactory -> {
          Map<String, PoolConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(PoolConfigurer.class, true, false);
          return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
        })
        .orElseGet(Collections::emptyList)
    );
}
origin: org.springframework.data/spring-data-geode-test

private Collection<Pool> resolvePools() {
  eagerlyInitializeSpringManagedPoolBeans();
  return nullSafeMap(PoolManager.getAll()).values();
}
origin: org.springframework.data/spring-data-gemfire

@Override
public Collection<T> findAllById(Iterable<ID> ids) {
  List<ID> keys = Streamable.of(ids).stream().collect(StreamUtils.toUnmodifiableList());
  return CollectionUtils.<ID, T>nullSafeMap(this.template.getAll(keys)).values().stream()
    .filter(Objects::nonNull).collect(Collectors.toList());
}
origin: org.springframework.data/spring-data-geode

@Override
public Collection<T> findAllById(Iterable<ID> ids) {
  List<ID> keys = Streamable.of(ids).stream().collect(StreamUtils.toUnmodifiableList());
  return CollectionUtils.<ID, T>nullSafeMap(this.template.getAll(keys)).values().stream()
    .filter(Objects::nonNull).collect(Collectors.toList());
}
org.springframework.data.gemfire.utilCollectionUtilsnullSafeMap

Javadoc

Null-safe operation returning the given Map if not nullor an empty Map if null.

Popular methods of CollectionUtils

  • asSet
    Returns an unmodifiable Set containing the elements from the given object array.
  • nullSafeIterable
    Returns the given Iterable if not null or empty, otherwise returns the defaultIterable.
  • nullSafeSet
    Null-safe operation returning the given Set if not nullor an empty Set if null.
  • iterable
    Adapts the given Iterator as an Iterable object for use within a for each loop.
  • nullSafeList
    Null-safe operation returning the given List if not nullor an empty List if null.
  • addAll
    Adds all elements from the given Iterable to the Collection.
  • containsAny
    Null-safe method to determines whether the given Collection contains any elements from the given arr
  • emptyIterable
    Returns an empty Iterable object.
  • isEmpty
  • newSortedMap
  • nullSafeCollection
    Null-safe operation returning the given Collection if not nullor an empty Collection (implemented wi
  • nullSafeEnumeration
    Null-safe operation returning the given Enumeration if not nullor an Collections#emptyEnumeration()
  • nullSafeCollection,
  • nullSafeEnumeration,
  • nullSafeIsEmpty,
  • nullSafeIterator,
  • nullSafeSize,
  • toIterator,
  • toString

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Path (java.nio.file)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now