当前位置: 首页>>代码示例>>Java>>正文


Java CollectionUtil类代码示例

本文整理汇总了Java中org.febit.util.CollectionUtil的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtil类的具体用法?Java CollectionUtil怎么用?Java CollectionUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CollectionUtil类属于org.febit.util包,在下文中一共展示了CollectionUtil类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDictMap

import org.febit.util.CollectionUtil; //导入依赖的package包/类
public Map<String, String> createDictMap(GeoLite2CsvDict dict) {
    Map<String, String> result = CollectionUtil.createMap(this.map.size());
    for (IntMap.Entry<DictEntry> entry : this.map) {
        DictEntry keyEntry = entry.getValue();
        DictEntry valueEntry = dict.get(keyEntry.geoId);
        if (valueEntry == null) {
            continue;
        }
        result.put(keyEntry.countryCode, valueEntry.countryCode);
        result.put(keyEntry.country, valueEntry.country);
        result.put(keyEntry.province, valueEntry.province);
        result.put(keyEntry.city, valueEntry.city);
        result.put(LocationUtil.fixProvince(keyEntry.province), valueEntry.province);
        result.put(LocationUtil.fixCity(keyEntry.city), valueEntry.city);
        result.put(StringUtil.cutSuffix(StringUtil.cutSuffix(keyEntry.city, "市"), "县"), valueEntry.city);
    }
    return result;
}
 
开发者ID:febit,项目名称:febit,代码行数:19,代码来源:GeoLite2CsvDict.java

示例2: initRoot

import org.febit.util.CollectionUtil; //导入依赖的package包/类
protected void initRoot() throws IOException {

        GlobalManager globalManager = this.templateEngine.getGlobalManager();
        globalManager.setConst("DEBUG", debug);
        globalManager.setConst("basePkg", basePkg);
        globalManager.setConst("modelPkg", modelPkg);
        globalManager.setConst("modelPrefix", modelPrefix);

        globalManager.setConst("db", config.extract("db."));

        globalManager.setConst("depends", depends);
        globalManager.setConst("testDepends", testDepends);
        globalManager.setConst("providedDepends", providedDepends);

        for (Map.Entry<String, String> entry : config.extract("extra.").entrySet()) {
            globalManager.setConst(entry.getKey(), entry.getValue());
        }

        this.tableList = tableFactory.getTables();
        this.whiteTables = CollectionUtil.toIter(this.tableList)
                .filter((Table table) -> !table.isBlackEntity)
                .readList();

        globalManager.setConst("tables", this.tableList);
    }
 
开发者ID:febit,项目名称:febit-generator,代码行数:26,代码来源:Generator.java

示例3: getParamStringMap

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static Map<String, String> getParamStringMap(HttpServletRequest request) {
    Map<String, Object> map = request.getParameterMap();

    boolean encode = "GET".equalsIgnoreCase(request.getMethod());
    Map<String, String> ret = CollectionUtil.createMap(map.size());
    for (Map.Entry<String, Object> entrySet : map.entrySet()) {
        Object value = entrySet.getValue();
        if (value == null) {
            continue;
        }
        if (value instanceof String[]) {
            String[] arr = (String[]) value;
            if (arr.length == 0) {
                continue;
            }
            value = arr[0];
        }
        if (encode) {
            try {
                ret.put(entrySet.getKey(), new String(value.toString().getBytes("ISO-8859-1"), "UTF-8"));
            } catch (UnsupportedEncodingException ignore) {
                ret.put(entrySet.getKey(), value.toString());
            }
        } else {
            ret.put(entrySet.getKey(), value.toString());
        }
    }
    return ret;
}
 
开发者ID:febit,项目名称:febit,代码行数:31,代码来源:ServletUtil.java

示例4: getParameterNames

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Iter<String> getParameterNames() {
    Enumeration<String> paramNames = this.request.getParameterNames();
    if (macroParams.isEmpty()) {
        return CollectionUtil.toIter(paramNames);
    }
    return CollectionUtil.concat(
            macroParams.keySet().iterator(),
            CollectionUtil.toIter(paramNames)
                    .filter(name -> !macroParams.containsKey(name))
    );
}
 
开发者ID:febit,项目名称:febit,代码行数:13,代码来源:ActionRequest.java

示例5: modifyMap

import org.febit.util.CollectionUtil; //导入依赖的package包/类
public static Map<String, Object> modifyMap(BaseFormImpl form, int profile) {
    Peer[] peers = getPeers(form, false, profile);
    if (peers.length == 0) {
        return Collections.emptyMap();
    }
    Map<String, Object> ret = CollectionUtil.createHashMap(profile);
    for (int i = 0, len = peers.length; i < len; i++) {
        Peer peer = peers[i];
        ret.put(peer.name, peer.from.get(form));
    }
    return ret;
}
 
开发者ID:febit,项目名称:febit-common,代码行数:13,代码来源:BaseFormUtil.java

示例6: resolveSetters

import org.febit.util.CollectionUtil; //导入依赖的package包/类
public static Map<String, Setter> resolveSetters(Class cls) {
    final FieldInfo[] fieldInfos = FieldInfoResolver.resolve(cls);
    final Map<String, Setter> map = CollectionUtil.createMap(fieldInfos.length);
    for (FieldInfo fieldInfo : fieldInfos) {
        Setter setter = createSetterIfAccessable(fieldInfo);
        if (setter != null) {
            map.put(fieldInfo.name, setter);
        }
    }
    return map;
}
 
开发者ID:febit,项目名称:febit-common,代码行数:12,代码来源:AccessFactory.java

示例7: resolveAccessors

import org.febit.util.CollectionUtil; //导入依赖的package包/类
static Map<String, Accessor> resolveAccessors(Class cls) {
    final FieldInfo[] fieldInfos = FieldInfoResolver.resolve(cls);
    final Map<String, Accessor> map = CollectionUtil.createMap(fieldInfos.length);
    for (FieldInfo fieldInfo : fieldInfos) {
        map.put(fieldInfo.name, createAccessor(fieldInfo));
    }
    return map;
}
 
开发者ID:febit,项目名称:febit-common,代码行数:9,代码来源:AccessFactory.java

示例8: resolveLinks

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static Map<String, Map<String, Entity>> resolveLinks(Collection<?> rows, Class type) {
    if (rows == null || rows.isEmpty()) {
        return null;
    }
    ArangoLinkInfo[] infos = LINKS_CACHING.unsafeGet(type);
    if (infos == null) {
        infos = collectInfosIfAbsent(type);
    }
    if (infos.length == 0) {
        return null;
    }
    final Map<String, Map<String, Entity>> ret = CollectionUtil.createMap(infos.length);

    final HashSet<String> ids = new HashSet<>(rows.size());
    for (ArangoLinkInfo info : infos) {

        //collect ids
        ids.clear();
        final Field field = info.field;
        for (Object row : rows) {
            try {
                String id = (String) field.get(row);
                if (id != null) {
                    ids.add(id);
                }
            } catch (IllegalArgumentException | IllegalAccessException ex) {
                throw new RuntimeException(ex);
            }
        }
        if (ids.isEmpty()) {
            continue;
        }

        //fetch entitys
        Map<String, Entity> map = CollectionUtil.createMap(ids.size());
        Map<String, Object> vars = new HashMap<>(4);
        vars.put("keys", ids);
        ArangoCursor<Entity> iterator = info.dao.cursor(
                "FOR d in " + info.dao.getTableName() + ""
                + " FILTER d._key in @keys "
                + " RETURN d",
                vars, null, info.linkType);

        while (iterator.hasNext()) {
            Entity next = iterator.next();
            map.put(next.id(), next);
        }
        ret.put(info.name, map);
    }

    return ret;
}
 
开发者ID:febit,项目名称:febit,代码行数:54,代码来源:ArangoUtil.java

示例9: map

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@Override
public <T> Iter<T> map(final Function1<T, E> func) {
    return CollectionUtil.map(this, func);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:5,代码来源:BaseIter.java

示例10: flatMap

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@Override
public <T> Iter<T> flatMap(final Function1<Iterator<T>, E> func) {
    return CollectionUtil.flatMap(this, func);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:5,代码来源:BaseIter.java

示例11: filter

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@Override
public Iter<E> filter(final Predicate<E> valid) {
    return CollectionUtil.filter(this, valid);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:5,代码来源:BaseIter.java

示例12: excludeNull

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@Override
public Iter<E> excludeNull() {
    return CollectionUtil.excludeNull(this);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:5,代码来源:BaseIter.java

示例13: readList

import org.febit.util.CollectionUtil; //导入依赖的package包/类
@Override
public List<E> readList() {
    return CollectionUtil.read(this);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:5,代码来源:BaseIter.java


注:本文中的org.febit.util.CollectionUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。