org.n52.janmayen.function.Functions.forSupplier()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.n52.janmayen.function.Functions.forSupplier()方法的一些代码示例,展示了Functions.forSupplier()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Functions.forSupplier()方法的具体详情如下:
包路径:org.n52.janmayen.function.Functions
类名称:Functions
方法名:forSupplier

Functions.forSupplier介绍

[英]Create a function for the the supplier, ignoring any supplied input.
[中]为供应商创建函数,忽略任何提供的输入。

代码示例

代码示例来源:origin: org.n52.janmayen/janmayen

public QueryBuilder add(String name, Iterable<Object> value) {
  List<String> list = query.computeIfAbsent(name, Functions.forSupplier(LinkedList::new));
  Streams.stream(value).filter(Objects::nonNull).map(Object::toString).forEach(list::add);
  return this;
}

代码示例来源:origin: org.n52.shetland/shetland

/**
 * Add key and values to map.
 *
 * @param <K>   the key type
 * @param <V>   the value type
 * @param map   the map
 * @param key   the key
 * @param value the values
 */
private static <K, V> void addToMap(SortedMap<K, SortedSet<V>> map, K key, Collection<V> value) {
  if (map != null && key != null && value != null) {
    map.computeIfAbsent(key, Functions.forSupplier(TreeSet::new)).addAll(value);
  }
}

代码示例来源:origin: org.n52.arctic-sea/shetland

/**
 * Add key and value to map.
 *
 * @param <K>   the key type
 * @param <V>   the value type
 * @param map   the map
 * @param key   the key
 * @param value the value
 */
private static <K, V> void addToMap(SortedMap<K, SortedSet<V>> map, K key, V value) {
  if (map != null && key != null && value != null) {
    map.computeIfAbsent(key, Functions.forSupplier(TreeSet::new)).add(value);
  }
}

代码示例来源:origin: org.n52.shetland/shetland

/**
 * Add key and value to map.
 *
 * @param <K>   the key type
 * @param <V>   the value type
 * @param map   the map
 * @param key   the key
 * @param value the value
 */
private static <K, V> void addToMap(SortedMap<K, SortedSet<V>> map, K key, V value) {
  if (map != null && key != null && value != null) {
    map.computeIfAbsent(key, Functions.forSupplier(TreeSet::new)).add(value);
  }
}

代码示例来源:origin: org.n52.arctic-sea/shetland

/**
 * Add key and values to map.
 *
 * @param <K>   the key type
 * @param <V>   the value type
 * @param map   the map
 * @param key   the key
 * @param value the values
 */
private static <K, V> void addToMap(SortedMap<K, SortedSet<V>> map, K key, Collection<V> value) {
  if (map != null && key != null && value != null) {
    map.computeIfAbsent(key, Functions.forSupplier(TreeSet::new)).addAll(value);
  }
}

代码示例来源:origin: org.n52.iceland/iceland

private Stream<OwsRequestMethod> getRequestMethodsForServiceURL(OwsOperationKey operation) {
  Map<String, Set<OwsValue>> mediaTypesByMethod = new HashMap<>(HTTPMethods.METHODS.size());
  this.bindingRepository.getBindings().values().stream()
      .forEach(binding -> HTTPMethods.METHODS.stream()
        .filter(isMethodSupported(binding, operation))
        .forEach(method ->
            mediaTypesByMethod.computeIfAbsent(method, Functions.forSupplier(HashSet::new))
                .addAll(getMediaTypes(binding))));
  return mediaTypesByMethod.entrySet().stream()
      .map(e -> new OwsRequestMethod(this.serviceURL, e.getKey(), createContentTypeDomains(e.getValue())));
}

代码示例来源:origin: 52North/SOS

protected void addResponseFormat(ResponseFormatKey key) {
  isActive(key);
  this.responseFormats.computeIfAbsent(key.getService(), Functions.forSupplier(HashMap::new))
      .computeIfAbsent(key.getVersion(), Functions.forSupplier(HashSet::new))
      .add(key.getResponseFormat());
}

代码示例来源:origin: org.n52.janmayen/janmayen

/**
 * Register a new {@link EventListener} to the {@link EventBus}.
 *
 * @param listener {@link EventListener} to register
 */
public void register(EventListener listener) {
  if (!checkListener(listener)) {
    return;
  }
  lock.writeLock().lock();
  try {
    listener.getTypes().stream()
        .peek(type -> LOG.debug("Subscibing Listener {} to EventType {}", listener, type))
        .map(type -> listeners.computeIfAbsent(type, Functions.forSupplier(HashSet::new)))
        .forEach(set -> set.add(listener));
  } finally {
    lock.writeLock().unlock();
  }
}

代码示例来源:origin: org.n52.faroe/faroe

private void configure(ConfigurableObject co, boolean persist) {
  LOG.debug("Configuring {}", co);
  if (persist) {
    this.configurableObjectsLock.writeLock().lock();
    try {
      this.configurableObjects.computeIfAbsent(co.getKey(), Functions.forSupplier(HashSet::new)).add(co);
    } finally {
      this.configurableObjectsLock.writeLock().unlock();
    }
  }
  try {
    co.configure(getSettingValue(co));
  } catch (RuntimeException cpe) {
    throw new ConfigurationError("Exception configuring " + co.getKey(), cpe);
  }
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

while (headerElements.hasNext()) {
  SOAPHeaderElement element = (SOAPHeaderElement) headerElements.next();
  headersByNamespace.computeIfAbsent(element.getNamespaceURI(), Functions.forSupplier(LinkedList::new))
      .add(element);

代码示例来源:origin: 52North/SOS

@Override
public void disableOfferingExtension(final String offering, final String identifier, final boolean disabled) throws
    NoSuchExtensionException, NoSuchOfferingException {
  checkOffering(offering);
  throwingExecute(new SetActiveOfferingExtensionAction(offering, identifier, disabled));
  oeLock.writeLock().lock();
  try {
    if (cachedOe != null) {
      Map<String, String> forOffering = cachedOe.computeIfAbsent(offering, Functions.forSupplier(HashMap::new));
      if (disabled) {
        forOffering.remove(identifier);
      } else if (!forOffering.containsKey(identifier)) {
        SosObservationOfferingExtension oe = execute(new GetOfferingExtensionAction(offering, identifier));
        forOffering.put(oe.getIdentifier(), oe.getExtension());
      }
    }
  } finally {
    oeLock.writeLock().unlock();
  }
}

相关文章

微信公众号

最新文章

更多