leap.lang.New.linkedHashMap()方法的使用及代码示例

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

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

New.linkedHashMap介绍

[英]Create a new LinkedHashMap
[中]创建一个新的LinkedHashMap

代码示例

代码示例来源:origin: org.leapframework/leap-lang

public static <T> Map<String, T> toMap(Collection<T> c, Function<T, String> key) {
  if(null == c) {
    return New.linkedHashMap();
  }
  Map<String,T> map = new LinkedHashMap<>(c.size());
  for(T item : c) {
    map.put(key.apply(item), item);
  }
  return map;
}

代码示例来源:origin: org.leapframework/leap-lang

public static <K,V> Map<K,V> buildMap(Map<K,? extends Buildable<V>> builders) {
  Map<K,V> m = New.linkedHashMap();
  for(Entry<K, ? extends Buildable<V>> e : builders.entrySet()) {
    m.put(e.getKey(), e.getValue().build());
  }
  return m;
}

代码示例来源:origin: org.leapframework/leap-orm

private Map<String, FieldMapping> createFieldNameToFieldsMap() {
  Map<String, FieldMapping> map = New.linkedHashMap();
  for (FieldMapping fm : fieldMappings) {
    map.put(fm.getFieldName().toLowerCase(), fm);
  }
  return Collections.unmodifiableMap(map);
}

代码示例来源:origin: org.leapframework/leap-orm

private Map<String, FieldMapping> createColumnNameToFieldsMap() {
  Map<String, FieldMapping> map = New.linkedHashMap();
  for (FieldMapping fm : fieldMappings) {
    map.put(fm.getColumn().getName().toLowerCase(), fm);
  }
  return Collections.unmodifiableMap(map);
}

代码示例来源:origin: org.leapframework/leap-orm

private Map<String, RelationMapping> createNameToRelationsMap() {
  Map<String, RelationMapping> map = New.linkedHashMap();
  for (RelationMapping r : relationMappings) {
    if (map.containsKey(r.getName())) {
      throw new IllegalStateException("Found duplicated relation name '" +
          r.getName() + "' in entity '" + entityName + "'");
    }
    map.put(r.getName(), r);
  }
  return Collections.unmodifiableMap(map);
}

相关文章