Tabnine Logo
CollectionUtils
Code IndexAdd Tabnine to your IDE (free)

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

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

Refine searchRefine arrow

  • Stream
  • StreamSupport
origin: org.springframework.data/spring-data-gemfire

@Override
public Set<SchemaObjectType> getSchemaObjectTypes() {
  return asSet(SchemaObjectType.INDEX);
}
origin: org.springframework.data/spring-data-geode

  public GemFireComponentClassTypeScanner withIncludes(Iterable<TypeFilter> includes) {
    stream(nullSafeIterable(includes).spliterator(), false).forEach(this.includes::add);
    return this;
  }
}
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-gemfire

public void setRegionNames(Iterable<String> regionNames) {
  this.regionNames = CollectionUtils.addAll(this.regionNames, nullSafeIterable(regionNames));
}
origin: org.springframework.data/spring-data-geode

private boolean isNamedRegion(String beanName, BeanDefinition beanDefinition,
    ConfigurableListableBeanFactory beanFactory) {
  return CollectionUtils.isEmpty(regionNames)
    || CollectionUtils.containsAny(regionNames, resolveBeanNames(beanName, beanDefinition, beanFactory));
}
origin: org.springframework.data/spring-data-gemfire

@Nullable
public static SchemaObjectDefiner compose(Iterable<SchemaObjectDefiner> schemaObjectDefiners) {
  Set<SchemaObjectDefiner> schemaObjectDefinerSet =
    stream(nullSafeIterable(schemaObjectDefiners).spliterator(), false)
      .filter(Objects::nonNull).collect(Collectors.toSet());
  return (schemaObjectDefinerSet.isEmpty() ? null
    : (schemaObjectDefinerSet.size() == 1 ? schemaObjectDefinerSet.iterator().next()
    : new ComposableSchemaObjectDefiner(schemaObjectDefinerSet)));
}
origin: org.springframework.geode/spring-geode-actuator

  private String toCommaDelimitedHostAndPortsString(List<InetSocketAddress> socketAddresses) {

    return StringUtils.collectionToCommaDelimitedString(nullSafeList(socketAddresses).stream()
      .filter(Objects::nonNull)
      .map(socketAddress -> String.format("%1$s:%2$d", socketAddress.getHostName(), socketAddress.getPort()))
      .collect(Collectors.toList()));
  }
}
origin: org.springframework.data/spring-data-gemfire

private Set<EnableSsl.Component> resolveComponents(AnnotationAttributes annotationAttributes) {
  Set<EnableSsl.Component> components =
    Arrays.stream(Optional.of(resolveProperty(sslProperty("components"), ""))
      .filter(StringUtils::hasText)
      .map(StringUtils::commaDelimitedListToStringArray)
      .orElseGet(() -> new String[0]))
      .map(EnableSsl.Component::valueOfName)
      .collect(Collectors.toSet());
  components = components.isEmpty()
    ? CollectionUtils.asSet((EnableSsl.Component[]) annotationAttributes.get("components"))
    : components;
  components = components.isEmpty() ? Collections.singleton(EnableSsl.Component.ALL) : components;
  return components;
}
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-gemfire

  private Set<Region> onlyClientRegions(Set<Region> regions) {
    return nullSafeSet(regions).stream().filter(RegionUtils::isClient).collect(Collectors.toSet());
  }
}
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-geode-test

new CopyOnWriteArrayList<>(nullSafeSet(baseRegionAttributes.getAsyncEventQueueIds()));
new CopyOnWriteArrayList<>(nullSafeSet(baseRegionAttributes.getGatewaySenderIds()));
  nullSafeArray(invocation.getArgument(0), CacheListener.class);
Arrays.stream(cacheListenersArgument).forEach(it ->
  Assert.notNull(it, "The CacheListener[] must not contain null elements"));
.thenAnswer(invocation -> asSet(asyncEventQueueIds.toArray(new String[asyncEventQueueIds.size()])));
.thenAnswer(invocation -> asSet(gatewaySenderIds.toArray(new String[gatewaySenderIds.size()])));
origin: org.springframework.data/spring-data-geode

protected OffHeapBeanFactoryPostProcessor(Set<String> regionNames) {
  this.regionNames = CollectionUtils.nullSafeSet(regionNames);
}
origin: org.springframework.data/spring-data-gemfire

/**
 * Returns a {@link List} of application domain object fields to be indexed.
 *
 * @return a {@link List} of application domain object fields to be indexed.
 * @see #getFieldAnalyzers()
 * @see java.util.List
 */
protected List<String> getFields() {
  return nullSafeList(this.fields);
}
origin: org.springframework.data/spring-data-geode-test

public static FileFilter and(Iterable<FileFilter> fileFilters) {
  FileFilter current = null;
  for (FileFilter fileFilter : nullSafeIterable(fileFilters)) {
    current = compose(current, LogicalOperator.AND, fileFilter);
  }
  return current;
}
origin: org.springframework.data/spring-data-geode-test

for (ZipEntry entry : CollectionUtils.iterable(zipFile.entries())) {
origin: org.springframework.data/spring-data-geode

protected boolean hasProperties(Properties properties) {
  return !CollectionUtils.isEmpty(properties);
}
origin: org.springframework.data/spring-data-geode

/**
 * A null-safe operation returning the original Iterable object if non-null or a default, empty Iterable
 * implementation if null.
 *
 * @param <T> the class type of the iterable elements.
 * @param iterable the Iterable object evaluated for a null reference.
 * @return the Iterable object if not null or a default, empty Iterable implementation otherwise.
 * @see #emptyIterable()
 * @see java.lang.Iterable
 */
@NonNull
public static <T> Iterable<T> nullSafeIterable(@Nullable Iterable<T> iterable) {
  return iterable != null ? iterable : emptyIterable();
}
origin: org.springframework.data/spring-data-gemfire

@Nullable
public static SchemaObjectCollector<?> compose(Iterable<SchemaObjectCollector<?>> schemaObjectCollectors) {
  List<SchemaObjectCollector<?>> schemaObjectCollectorList =
    stream(nullSafeIterable(schemaObjectCollectors).spliterator(), false)
      .filter(Objects::nonNull).collect(Collectors.toList());
  return (schemaObjectCollectorList.isEmpty() ? null
    : (schemaObjectCollectorList.size() == 1 ? schemaObjectCollectorList.iterator().next()
      : new ComposableSchemaObjectCollector(schemaObjectCollectorList)));
}
origin: org.springframework.data/spring-data-geode

private Set<EnableSsl.Component> resolveComponents(AnnotationAttributes annotationAttributes) {
  Set<EnableSsl.Component> components =
    Arrays.stream(Optional.of(resolveProperty(sslProperty("components"), ""))
      .filter(StringUtils::hasText)
      .map(StringUtils::commaDelimitedListToStringArray)
      .orElseGet(() -> new String[0]))
      .map(EnableSsl.Component::valueOfName)
      .collect(Collectors.toSet());
  components = components.isEmpty()
    ? CollectionUtils.asSet((EnableSsl.Component[]) annotationAttributes.get("components"))
    : components;
  components = components.isEmpty() ? Collections.singleton(EnableSsl.Component.ALL) : components;
  return components;
}
org.springframework.data.gemfire.utilCollectionUtils

Javadoc

CollectionUtils is a utility class for working with the Java Collections Framework and classes.

Most used methods

  • 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.
  • nullSafeMap
    Null-safe operation returning the given Map if not nullor an empty Map if null.
  • 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
  • newSortedMap,
  • nullSafeCollection,
  • nullSafeEnumeration,
  • nullSafeIsEmpty,
  • nullSafeIterator,
  • nullSafeSize,
  • toIterator,
  • toString

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Notification (javax.management)
  • Top plugins for Android Studio
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