io.vavr.collection.Map.containsKey()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(228)

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

Map.containsKey介绍

[英]Returns true if this map contains a mapping for the specified key.
[中]如果此映射包含指定键的映射,则返回true

代码示例

代码示例来源:origin: vavr-io/vavr

@Override
  public boolean isDefinedAt(K key) {
    return containsKey(key);
  }
};

代码示例来源:origin: vavr-io/vavr

@Override
public boolean containsKey(K key) {
  return back.containsKey(key);
}

代码示例来源:origin: vavr-io/vavr

@Deprecated
@Override
default boolean isDefinedAt(K key) {
  return containsKey(key);
}

代码示例来源:origin: vavr-io/vavr

@SuppressWarnings("unchecked")
static <K, V, M extends Map<K, V>> M replaceValue(M map, K key, V value) {
  return map.containsKey(key) ? (M) map.put(key, value) : map;
}

代码示例来源:origin: vavr-io/vavr

@SuppressWarnings("unchecked")
static <K, V, M extends Map<K, V>> M replace(M map, Tuple2<K, V> currentElement, Tuple2<K, V> newElement) {
  Objects.requireNonNull(currentElement, "currentElement is null");
  Objects.requireNonNull(newElement, "newElement is null");
  return (M) (map.containsKey(currentElement._1) ? map.remove(currentElement._1).put(newElement) : map);
}

代码示例来源:origin: vavr-io/vavr

@SuppressWarnings("unchecked")
@Override
public M remove(K key) {
  return (M) (back.containsKey(key) ? createFromMap(back.remove(key)) : this);
}

代码示例来源:origin: jdbi/jdbi

@Override
public boolean accepts(Type containerType) {
  Class<?> erasedType = getCollectionType(containerType);
  final boolean hasCollector = collectors.containsKey(erasedType);
  return (hasCollector || hasDefaultImplementationWithCollector(erasedType))
      && containerType instanceof ParameterizedType;
}

代码示例来源:origin: vavr-io/vavr

static <K, V, M extends Map<K, V>> M merge(M map, OfEntries<K, V, M> ofEntries,
    Map<? extends K, ? extends V> that) {
  Objects.requireNonNull(that, "that is null");
  if (map.isEmpty()) {
    return ofEntries.apply(Map.narrow(that));
  } else if (that.isEmpty()) {
    return map;
  } else {
    return that.foldLeft(map, (result, entry) -> !result.containsKey(entry._1) ? put(result, entry) : result);
  }
}

代码示例来源:origin: apache/incubator-pinot

final boolean hasRealtime = config.containsKey("table.type.realtime");
final boolean hasOffline = config.containsKey("table.type.offline");

代码示例来源:origin: apache/incubator-pinot

if (config.containsKey(keyName)) {
 Object dslValue = dsl.parse(config.getOrElse(keyName, null).toString());
 Map<String, ?> dslValues = Serializer.serialize(dslValue);

代码示例来源:origin: apache/incubator-pinot

String destinationKey = enabledProfileKey.substring(0, lastUnderscoreIndex);
if (!overrideConfigMap.containsKey(destinationKey)) {
 overrideConfigMap = overrideConfigMap.put(Tuple.of(destinationKey, config.getValue(enabledProfileKey)));
} else {

代码示例来源:origin: vavr-io/vavr

@SuppressWarnings("unchecked")
private <K2, V2> Multimap<K2, V2> createFromEntries(Iterable<? extends Tuple2<? extends K2, ? extends V2>> entries) {
  Map<K2, Traversable<V2>> back = emptyMapSupplier();
  for (Tuple2<? extends K2, ? extends V2> entry : entries) {
    if (back.containsKey(entry._1)) {
      back = back.put(entry._1, containerType.add(back.get(entry._1).get(), entry._2));
    } else {
      back = back.put(entry._1, containerType.add(emptyContainer.get(), entry._2));
    }
  }
  return createFromMap(back);
}

代码示例来源:origin: io.vavr/vavr

@Override
  public boolean isDefinedAt(K key) {
    return containsKey(key);
  }
};

代码示例来源:origin: io.vavr/vavr

@Override
public boolean containsKey(K key) {
  return back.containsKey(key);
}

代码示例来源:origin: io.vavr/vavr

@Deprecated
@Override
default boolean isDefinedAt(K key) {
  return containsKey(key);
}

代码示例来源:origin: HalBuilder/halbuilder-core

public void validateNamespaces(String rel) {
 if (!rel.contains("://") && rel.contains(":")) {
  String[] relPart = rel.split(":");
  if (!namespaces.containsKey(relPart[0])) {
   throw new RepresentationException(
     format("Undeclared namespace in rel %s for resource", rel));
  }
 }
}

代码示例来源:origin: io.vavr/vavr

@SuppressWarnings("unchecked")
static <K, V, M extends Map<K, V>> M replace(M map, Tuple2<K, V> currentElement, Tuple2<K, V> newElement) {
  Objects.requireNonNull(currentElement, "currentElement is null");
  Objects.requireNonNull(newElement, "newElement is null");
  return (M) (map.containsKey(currentElement._1) ? map.remove(currentElement._1).put(newElement) : map);
}

代码示例来源:origin: io.vavr/vavr

@SuppressWarnings("unchecked")
@Override
public M remove(K key) {
  return (M) (back.containsKey(key) ? createFromMap(back.remove(key)) : this);
}

代码示例来源:origin: io.vavr/vavr

static <K, V, M extends Map<K, V>> M merge(M map, OfEntries<K, V, M> ofEntries,
    Map<? extends K, ? extends V> that) {
  Objects.requireNonNull(that, "that is null");
  if (map.isEmpty()) {
    return ofEntries.apply(Map.narrow(that));
  } else if (that.isEmpty()) {
    return map;
  } else {
    return that.foldLeft(map, (result, entry) -> !result.containsKey(entry._1) ? put(result, entry) : result);
  }
}

代码示例来源:origin: io.vavr/vavr

@SuppressWarnings("unchecked")
private <K2, V2> Multimap<K2, V2> createFromEntries(Iterable<? extends Tuple2<? extends K2, ? extends V2>> entries) {
  Map<K2, Traversable<V2>> back = emptyMapSupplier();
  for (Tuple2<? extends K2, ? extends V2> entry : entries) {
    if (back.containsKey(entry._1)) {
      back = back.put(entry._1, containerType.add(back.get(entry._1).get(), entry._2));
    } else {
      back = back.put(entry._1, containerType.add(emptyContainer.get(), entry._2));
    }
  }
  return createFromMap(back);
}

相关文章