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

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

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

MultiMap.get介绍

[英]Returns the elements indexed by the provided key
[中]返回由提供的键索引的元素

代码示例

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

static String innerSort(String line) {
 MultiMap<String, String> mm = split(line);
 StringBuilder sb = new StringBuilder();
 // class
 List<String> vals = mm.remove("class");
 assert(null != vals && 1 == vals.size());
 sb.append("class=").append(vals.iterator().next());
 
 // indicies
 vals = mm.remove("index");
 if (null != vals && vals.size() > 0) {
  Collections.sort(vals);
  for (String index : vals) {
   sb.append(",index=").append(index);
  }
 }
 
 // metadata
 vals = new ArrayList<String>(mm.keySet());
 Collections.sort(vals);
 for (String key : vals) {
  List<String> subVals = new ArrayList<String>(mm.get(key));
  Collections.sort(subVals);
  for (String val : subVals) {
   sb.append(",").append(key).append("=").append(val);
  }
 }
 return sb.toString();
}

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

/**
 * Gets all the inhabitants that has the given implementation type name.
 */
public Collection<Inhabitant<?>> getInhabitantsByType(
    String fullyQualifiedClassName) {
  return (Collection) byType.get(fullyQualifiedClassName);
}

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

public Collection<Inhabitant<?>> getAllInhabitantsByContract(
    String contractType) {
  final List<NamedInhabitant> l = byContract.get(contractType);
  return new AbstractList<Inhabitant<?>>() {
    public Inhabitant<?> get(int index) {
      return l.get(index).inhabitant;
    }
    public int size() {
      return l.size();
    }
  };
}

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

/**
 * Gets all the inhabitants that has the given implementation type name.
 */
public Collection<Inhabitant<?>> getInhabitantsByType(
    String fullyQualifiedClassName) {
  return (Collection) byType.get(fullyQualifiedClassName);
}

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

public <T> Collection<T> getAllByContract(String contractType) {
  final List<NamedInhabitant> l = byContract.get(contractType);
  return new AbstractList<T>() {
    public T get(int index) {
      return (T) l.get(index).inhabitant.get();
    }
    public int size() {
      return l.size();
    }
  };
}

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

public <T> Collection<T> getAllByContract(String contractType) {
  final List<NamedInhabitant> l = byContract.get(contractType);
  return new AbstractList<T>() {
    public T get(int index) {
      return (T) l.get(index).inhabitant.get();
    }
    public int size() {
      return l.size();
    }
  };
}

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

/**
 * Checks if the map contains the given key.
 *
 * @param k key to test
 * @return true if the map contains at least one element for this key
 */
public boolean containsKey(K k) {
  return !get(k).isEmpty();
}

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

/**
 * Checks if the map contains the given key.
 *
 * @param k key to test
 * @return true if the map contains at least one element for this key
 */
public boolean containsKey(K k) {
  return !get(k).isEmpty();
}

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

/**
 * Checks if the map contains the given key.
 *
 * @param k key to test
 * @return true if the map contains at least one element for this key
 */
@Override
public boolean containsKey(K k) {
  return !get(k).isEmpty();
}

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

/**
 * Gets all the inhabitants that has the given implementation type.
 */
public <T> Collection<Inhabitant<T>> getInhabitantsByType(Class<T> implType)
    throws ComponentException {
  return (Collection) byType.get(implType.getName());
}

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

/**
 * Gets all matching inhabitants given the type.
 *
 * @return can be empty but never null.
 */
public <T> Collection<Inhabitant> getAllInhabitantsByType(Class<T> implType) {
  final List<Inhabitant> l = byType.get(implType.getName());
  return l;
}

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

/**
 * Gets all the inhabitants that has the given implementation type.
 */
public <T> Collection<Inhabitant<T>> getInhabitantsByType(Class<T> implType)
    throws ComponentException {
  return (Collection) byType.get(implType.getName());
}

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

/**
 * Checks if the map contains the given key.
 *
 * @param k key to test
 * @return true if the map contains at least one element for this key
 */
@Override
public boolean containsKey(K k) {
  return !get(k).isEmpty();
}

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

public Inhabitant<?> getInhabitantByType(String fullyQualifiedClassName) {
  List<Inhabitant> list = byType.get(fullyQualifiedClassName);
  if (list.isEmpty()) {
    return null;
  }
  return list.get(0);
}

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

public Inhabitant<?> getInhabitantByType(String fullyQualifiedClassName) {
  List<Inhabitant> list = byType.get(fullyQualifiedClassName);
  if (list.isEmpty()) {
    return null;
  }
  return list.get(0);
}

代码示例来源:origin: org.glassfish.main.admingui/console-plugin-service

/**
 *    <p> This method returns the {@link IntegrationPoint}s associated with
 *        the given type.</p>
 *
 *    @param    type    The type of {@link IntegrationPoint}s to retrieve.
 */
public List<IntegrationPoint> getIntegrationPoints(String type) {
init();    // Ensure it is initialized.
return pointsByType.get(type);
}

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

public <T> T getByContract(String contractType) {
  List<NamedInhabitant> l = byContract.get(contractType);
  if (l.isEmpty()) {
    return null;
  } else {
    return (T) l.get(0).inhabitant.get();
  }
}

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

private Object getBy(String implTypeName, MultiMap<String, Inhabitant> index) {
  List<Inhabitant> l = index.get(implTypeName);
  if (l.isEmpty()) {
    return null;
  } else {
    return l.get(0).get();
  }
}

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

private static void add(MultiMap<String, String> dest, String key, String val) {
 List<String> vals = dest.get(key);
 if (null == vals || !vals.contains(val)) {
  dest.add(key, val);
 }
}

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

private static void add(MultiMap<String, String> dest, String key, String val) {
 List<String> vals = dest.get(key);
 if (null == vals || !vals.contains(val)) {
  dest.add(key, val);
 }
}

相关文章