• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ListOrderedMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: node2json

import org.apache.commons.collections4.map.ListOrderedMap; //导入依赖的package包/类
private Object node2json(Element element) throws Exception {
        Map map = new ListOrderedMap();
        String xpath = getXPath(element);
        if (singles.contains(xpath)) {
                if (element.getFirstChild() != null)
                        return listner.text(element.getFirstChild().getNodeValue());
                else
                        return "";
        }
        NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
                Node attr = attrs.item(i);
                String name = attr.getNodeName();
                String value = attr.getNodeValue();
                map.put(name, listner.text(value));
        }
        NodeList childs = element.getChildNodes();
        nodelist2json(map, childs);
        return new JSONObject(map);
}
 
开发者ID:consag,项目名称:fitnessefixtures,代码行数:21,代码来源:Xml2Json.java


示例2: verifyEncodeDecodeTGTWithListOrderedMap

import org.apache.commons.collections4.map.ListOrderedMap; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithListOrderedMap() throws Exception {
    final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
    @SuppressWarnings("unchecked")
    final TicketGrantingTicket expectedTGT =
            new MockTicketGrantingTicket(TGT_ID, userPassCredential, ListOrderedMap.listOrderedMap(this.principalAttributes));
    expectedTGT.grantServiceTicket(ST_ID, null, null, false);
    assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:KryoTranscoderTests.java


示例3: xml2jsonObj

import org.apache.commons.collections4.map.ListOrderedMap; //导入依赖的package包/类
public JSONObject xml2jsonObj(NodeList nodes) throws Exception {
        this.basePath = null;
        if (nodes == null || nodes.getLength() == 0)
                return null;
        Node baseNode = nodes.item(0).getParentNode();
        if (baseNode == null)
                return null;
        this.basePath = getXPath((Element) baseNode);
        Map map = new ListOrderedMap();
        nodelist2json(map, nodes);
        return new JSONObject(map);
}
 
开发者ID:consag,项目名称:fitnessefixtures,代码行数:13,代码来源:Xml2Json.java


示例4: toApiObject

import org.apache.commons.collections4.map.ListOrderedMap; //导入依赖的package包/类
private Loop toApiObject(com.imcode.imcms.mapping.jpa.doc.content.textdoc.Loop jpaLoop) {
    if (jpaLoop == null) {
        return null;

    } else {
        Map<Integer, Boolean> entries = new ListOrderedMap<>();
        jpaLoop.getEntries().forEach(entry -> entries.put(entry.getNo(), entry.isEnabled()));
        return Loop.of(entries, jpaLoop.getNextEntryNo());
    }
}
 
开发者ID:imCodePartnerAB,项目名称:imcms,代码行数:11,代码来源:TextDocumentContentLoader.java


示例5: doPost

import org.apache.commons.collections4.map.ListOrderedMap; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.POST)
protected Object doPost(@RequestParam(value = "indexes[]", required = false) List<Integer> indexes,
                        @RequestParam(value = "isEnabledFlags[]", required = false) List<Boolean> isEnabledFlags,
                        @RequestParam("loopId") Integer loopId,
                        @RequestParam("meta") Integer metaId) throws ServletException, IOException {

    Map<String, Object> result = new HashMap<>();

    if (indexes == null || isEnabledFlags == null) {
        indexes = new ArrayList<>();
        isEnabledFlags = new ArrayList<>();
    }

    if (indexes.size() != isEnabledFlags.size()) {
        result.put("message", "Different sizes of collections");
        result.put("result", false);

    } else {
        try {
            ImcmsServices imcmsServices = Imcms.getServices();
            DocumentMapper documentMapper = imcmsServices.getDocumentMapper();
            TextDocumentDomainObject document = documentMapper.getWorkingDocument(metaId);
            TextDocumentContentSaver contentSaver = imcmsServices.getManagedBean(TextDocumentContentSaver.class);

            Map<Integer, Boolean> entries = new ListOrderedMap<>();

            for (int i = 0; i < indexes.size(); i++) {
                entries.put(indexes.get(i), isEnabledFlags.get(i));
            }

            Loop loop = Loop.of(entries);
            Predicate<TextDocumentDomainObject.LoopItemRef> loopItemRefPredicate = entry ->
                    (loopId.equals(entry.getLoopNo()) && !loop.findEntryIndexByNo(entry.getEntryNo()).isPresent());

            document.getLoopImages().keySet().stream()
                    .filter(loopItemRefPredicate)
                    .forEach(document::deleteImage);

            document.getLoopTexts().keySet().stream()
                    .filter(loopItemRefPredicate)
                    .forEach(entry -> contentSaver.deleteText(document, entry));

            document.setLoop(loopId, loop);
            documentMapper.saveDocument(document, Imcms.getUser());

            TextDocLoopContainer container = new TextDocLoopContainer(document.getVersionRef(), loopId, loop);
            contentSaver.saveLoop(container);
            documentMapper.invalidateDocument(metaId);

            result.put("result", true);

        } catch (Exception e) {
            result.put("message", e);
            result.put("result", false);
        }
    }

    return result;
}
 
开发者ID:imCodePartnerAB,项目名称:imcms,代码行数:60,代码来源:LoopController.java


示例6: orderedMap

import org.apache.commons.collections4.map.ListOrderedMap; //导入依赖的package包/类
/**
 * Returns a map that maintains the order of keys that are added
 * backed by the given map.
 * <p>
 * If a key is added twice, the order is determined by the first add.
 * The order is observed through the keySet, values and entrySet.
 *
 * @param <K>  the key type
 * @param <V>  the value type
 * @param map  the map to order, must not be null
 * @return an ordered map backed by the given map
 * @throws NullPointerException  if the Map is null
 */
public static <K, V> OrderedMap<K, V> orderedMap(final Map<K, V> map) {
    return ListOrderedMap.listOrderedMap(map);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:17,代码来源:MapUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClosestHeuristic类代码示例发布时间:2022-05-23
下一篇:
Java DistanceJoint类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap