org.jvnet.hk2.component.MultiMap.newList()方法的使用及代码示例

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

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

MultiMap.newList介绍

[英]Creates an optionally populated list to be used as an entry in the map.
[中]创建一个可选填充列表,用作地图中的条目。

代码示例

代码示例来源:origin: com.sun.enterprise/auto-depends

/**
 * Replaces all the existing values associated with the key
 * by the given value.
 *
 * @param k key for the values
 * @param v Can be null or empty.
 */
public void set(K k, Collection<? extends V> v) {
  store.put(k, newList(v));
}

代码示例来源:origin: org.glassfish.hk2/auto-depends

/**
 * Replaces all the existing values associated with the key
 * by the given value.
 *
 * @param k key for the values
 * @param v Can be null or empty.
 */
public void set(K k, Collection<? extends V> v) {
  store.put(k, newList(v));
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Replaces all the existing values associated with the key
 * by the given single value.
 *
 * @param k key for the values
 * @param v singleton value for k key
 *          <p/>
 *          This is short for <tt>set(k,Collections.singleton(v))</tt>
 */
public void set(K k, V v) {
  List<V> vlist = newList(null);
  vlist.add(v);
  store.put(k, vlist);
}

代码示例来源:origin: org.glassfish.hk2/auto-depends

/**
 * Replaces all the existing values associated with the key
 * by the given single value.
 *
 * @param k key for the values
 * @param v singleton value for k key
 *          <p/>
 *          This is short for <tt>set(k,Collections.singleton(v))</tt>
 */
public void set(K k, V v) {
  List<V> vlist = newList(null);
  vlist.add(v);
  store.put(k, vlist);
}

代码示例来源:origin: com.sun.enterprise/auto-depends

/**
 * Replaces all the existing values associated with the key
 * by the given single value.
 *
 * @param k key for the values
 * @param v singleton value for k key
 *          <p/>
 *          This is short for <tt>set(k,Collections.singleton(v))</tt>
 */
public void set(K k, V v) {
  List<V> vlist = newList(null);
  vlist.add(v);
  store.put(k, vlist);
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Replaces all the existing values associated with the key
 * by the given single value.
 *
 * @param k key for the values
 * @param v singleton value for k key
 *          <p/>
 *          This is short for <tt>set(k,Collections.singleton(v))</tt>
 */
public void set(K k, V v) {
  List<V> vlist = newList(null);
  vlist.add(v);
  store.put(k, vlist);
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Replaces all the existing values associated with the key
 * by the given single value.
 *
 * @param k key for the values
 * @param v singleton value for k key
 *          <p/>
 *          This is short for <tt>set(k,Collections.singleton(v))</tt>
 */
public void set(K k, V v) {
  List<V> vlist = newList(null);
  vlist.add(v);
  store.put(k, vlist);
}

代码示例来源:origin: javaee/hk2

/**
 * Replaces all the existing values associated with the key
 * by the given single value.
 *
 * @param k key for the values
 * @param v singleton value for k key
 *          <p/>
 *          This is short for <tt>set(k,Collections.singleton(v))</tt>
 */
public void set(K k, V v) {
  List<V> vlist = newList(null);
  vlist.add(v);
  store.put(k, vlist);
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Adds one more key-value pair.
 *
 * @param k key to store the entry under
 * @param v value to store in the k's values.
 */
public final void add(K k, V v) {
  List<V> l = store.get(k);
  if (l == null) {
    l = newList(null);
    store.put(k, l);
  }
  l.add(v);
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Adds one more key-value pair.
 *
 * @param k key to store the entry under
 * @param v value to store in the k's values.
 */
public final void add(K k, V v) {
  List<V> l = store.get(k);
  if (l == null) {
    l = newList(null);
    store.put(k, l);
  }
  l.add(v);
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Adds one more key-value pair.
 *
 * @param k key to store the entry under
 * @param v value to store in the k's values.
 */
public final void add(K k, V v) {
  List<V> l = store.get(k);
  if (l == null) {
    l = newList(null);
    store.put(k, l);
  }
  l.add(v);
}

代码示例来源:origin: javaee/hk2

/**
 * Adds one more key-value pair.
 *
 * @param k key to store the entry under
 * @param v value to store in the k's values.
 */
public final void add(K k, V v) {
  List<V> l = store.get(k);
  if (l == null) {
    l = newList(null);
    store.put(k, l);
  }
  l.add(v);
}

代码示例来源:origin: javaee/hk2

/**
 * Copy constructor.
 *
 * @param base map to copy
 */
public MultiMap(MultiMap<K, V> base) {
  this();
  for (Map.Entry<K, List<V>> e : base.entrySet()) {
    List<V> value = newList(e.getValue());
    if (!value.isEmpty()) {
      store.put(e.getKey(), newList(e.getValue()));
    }
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Copy constructor.
 *
 * @param base map to copy
 */
public MultiMap(MultiMap<K, V> base) {
  this();
  for (Map.Entry<K, List<V>> e : base.entrySet()) {
    List<V> value = newList(e.getValue());
    if (!value.isEmpty()) {
      store.put(e.getKey(), newList(e.getValue()));
    }
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Copy constructor.
 *
 * @param base map to copy
 */
public MultiMap(MultiMap<K, V> base) {
  this();
  for (Map.Entry<K, List<V>> e : base.entrySet()) {
    List<V> value = newList(e.getValue());
    if (!value.isEmpty()) {
      store.put(e.getKey(), newList(e.getValue()));
    }
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

/**
 * Copy constructor.
 *
 * @param base map to copy
 */
public MultiMap(MultiMap<K, V> base) {
  this();
  for (Map.Entry<K, List<V>> e : base.entrySet()) {
    List<V> value = newList(e.getValue());
    if (!value.isEmpty()) {
      store.put(e.getKey(), newList(e.getValue()));
    }
  }
}

代码示例来源:origin: com.sun.enterprise/auto-depends

/**
 * Adds one more key-value pair.
 *
 * @param k key to store the entry under
 * @param v value to store in the k's values.
 */
public final void add(K k, V v) {
  if (!modifiable) {
    throw new UnsupportedOperationException("unmodifiable collection");
  }
  
  List<V> l = store.get(k);
  if (l == null) {
    l = newList(null);
    store.put(k, l);
  }
  l.add(v);
}

代码示例来源:origin: org.glassfish.hk2/auto-depends

/**
 * Copy constructor.
 *
 * @param base map to copy
 */
public MultiMap(org.glassfish.hk2.MultiMap<K, V> base) {
  this();
  for (Entry<K, List<V>> e : base.entrySet()) {
    store.put(e.getKey(), newList(e.getValue()));
  }
}

代码示例来源:origin: com.sun.enterprise/auto-depends

/**
 * Copy constructor.
 *
 * @param base map to copy
 */
public MultiMap(org.glassfish.hk2.MultiMap<K, V> base) {
  this();
  for (Entry<K, List<V>> e : base.entrySet()) {
    store.put(e.getKey(), newList(e.getValue()));
  }
}

代码示例来源:origin: org.glassfish.hk2/auto-depends

public void mergeAll(org.glassfish.hk2.MultiMap<K, V> another) {
  if (null != another) {
    for (Entry<K, List<V>> entry : another.entrySet()) {
      List<V> ourList = store.get(entry.getKey());
      if (null == ourList) {
        ourList = newList(entry.getValue());
        store.put(entry.getKey(), ourList);
      } else {
        for (V v : entry.getValue()) {
          if (!ourList.contains(v)) {
            ourList.add(v);
          }
        }
      }
    }
  }
}

相关文章