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

Java MapEntry类代码示例

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

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



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

示例1: entryAt

import clojure.lang.MapEntry; //导入依赖的package包/类
public IMapEntry entryAt(Object key) {
    int hash = Util.hasheq(key);
    int h = hash;
    int hops = 7;
    Node node = root;
    loop: for (;;) {
        int shift = (h & 31)*2;
        long lead = node.bitmap >>> shift;
        int pos = Long.bitCount(lead);
        int bits = (int) (lead & 3L);
        switch (bits) {
        case 0:
            return null;
        case 3:
            Object k = node.array[pos-2];
            return Util.equiv(key, k) ? new MapEntry(k, node.array[pos-1]) : null;
        default:
            hops--;
            if (hops == 0) return Collisions.lookup(node.array[pos-1], key);
            h >>>= 5;
            node = (Node) node.array[pos-1];
            continue loop;
        }
    }
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:26,代码来源:ConfluentHashMap.java


示例2: prioritySeq

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq prioritySeq(final int countdown, final Loser losers, final Object ubound) {
    if (0 == countdown)
        return null;

    return new LazySeq(
            new AFn() {
                public Object invoke() {
                    MatchFrame mf = new MatchFrame();
                    secondBest(losers, ubound, mf);
                    Object lkey = mf.lkey;
                    Object lpriority = mf.lpriority;
                    Loser llosers = mf.llosers;
                    Object lubound = mf.lubound;
                    return new Cons(
                            new MapEntry(lkey, lpriority),
                            prioritySeq(countdown - 1, llosers, lubound)
                    );
                }
            }
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:22,代码来源:PersistentPrioritySearchQueue.java


示例3: lookup

import clojure.lang.MapEntry; //导入依赖的package包/类
MapEntry lookup(Object key, Winner winner) {
    if (null == winner)
        return null;

    if (0 == kcomp.compare(key, winner.key))
        return new MapEntry(winner.key, winner.priority);

    Loser losers = winner.losers;
    while (null != losers) {
        if (0 == kcomp.compare(key, losers.key))
            return new MapEntry(losers.key, losers.priority);
        if (0 < kcomp.compare(key, losers.split)) {
            losers = losers.right;
            continue;
        }
        losers = losers.left;
    }
    return null;
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java


示例4: traverseFrom

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq traverseFrom(final Object lbound, Winner winner) {
    if (null == winner)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(lbound, lkey) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lbound, lubound) <= 0 ?
                            traverseFrom(lbound, match.left) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseFrom(lbound, match.right);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:27,代码来源:PersistentPrioritySearchQueue.java


示例5: rtraverseFrom

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq rtraverseFrom(final Object ubound, Winner winner) {
    if (null == winner)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(lkey, ubound) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, ubound) <= 0 ?
                            rtraverseFrom(ubound, match.right) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseFrom(ubound, match.left);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:27,代码来源:PersistentPrioritySearchQueue.java


示例6: traverseAtMost

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq traverseAtMost(final Object priority, final Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) > 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseAtMost(priority, match.left);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseAtMost(priority, match.right);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java


示例7: traverseBelow

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq traverseBelow(final Object priority, final Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) >= 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseBelow(priority, match.left);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseBelow(priority, match.right);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java


示例8: rtraverseAtMost

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq rtraverseAtMost(final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) > 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseAtMost(priority, match.right);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseAtMost(priority, match.left);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java


示例9: rtraverseBelow

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq rtraverseBelow(final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) >= 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseBelow(priority, match.right);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseBelow(priority, match.left);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java


示例10: nth

import clojure.lang.MapEntry; //导入依赖的package包/类
public Object nth(int i, Object notFound) {
    if (i < 0 || i >= _count)
        throw new IndexOutOfBoundsException();
    if (i == _count - 1)
        return entryAt(winner.ubound);
    Loser loser = winner.losers;
    while (loser != null) {
        int rank = size(loser.left);
        if (i < rank) {
            loser = loser.left;
            continue;
        } else if (i > rank) {
            i -= rank + 1;
            loser = loser.right;
            continue;
        }
        return entryAt(loser.split);
    }
    return new MapEntry(winner.key, winner.priority);
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:21,代码来源:PersistentPrioritySearchQueue.java


示例11: nearestRight

import clojure.lang.MapEntry; //导入依赖的package包/类
public MapEntry nearestRight(Object key, boolean inclusive) {
    if (null == winner)
        return null;

    int topc = kcomp.compare(key, winner.ubound);
    if (0 == topc) {
        if (inclusive)
            return lookup(key, winner);
        return null;
    } else if (topc > 0) {
        return null;
    }

    Object prevSplit = winner.ubound;
    Loser loser = winner.losers;
    while (null != loser) {
        int c = kcomp.compare(key, loser.split);
        if (0 == c) {
            if (inclusive)
                return lookup(key, winner);
            loser = loser.right;
        } else if (c > 0) {
            loser = loser.right;
        } else {
            prevSplit = loser.split;
            loser = loser.left;
        }
    }
    return lookup(prevSplit, winner);
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:31,代码来源:PersistentPrioritySearchQueue.java


示例12: traverse

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq traverse(final Object key, final Object priority, Loser losers) {
    if (null == losers)
        return RT.list(new MapEntry(key, priority));
    final Object lkey = losers.key;
    final Object lpriority = losers.priority;
    final Loser lleft = losers.left;
    final Loser lright = losers.right;
    if (kcomp.compare(lkey, losers.split) <= 0)
        return concat(
                new LazySeq(new AFn() {
                    public ISeq invoke() {
                        return traverse(lkey, lpriority, lleft);
                    }
                }),
                new LazySeq(new AFn() {
                    public ISeq invoke() {
                        return traverse(key, priority, lright);
                    }
                })
        );
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverse(key, priority, lleft);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverse(lkey, lpriority, lright);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:34,代码来源:PersistentPrioritySearchQueue.java


示例13: rtraverse

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq rtraverse(final Object key, final Object priority, Loser losers) {
    if (null == losers)
        return RT.list(new MapEntry(key, priority));
    final Object lkey = losers.key;
    final Object lpriority = losers.priority;
    final Loser lleft = losers.left;
    final Loser lright = losers.right;
    if (kcomp.compare(lkey, losers.split) <= 0)
        return concat(
                new LazySeq(new AFn() {
                    public ISeq invoke() {
                        return rtraverse(key, priority, lright);
                    }
                }),
                new LazySeq(new AFn() {
                    public ISeq invoke() {
                        return rtraverse(lkey, lpriority, lleft);
                    }
                })
        );
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverse(lkey, lpriority, lright);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverse(key, priority, lleft);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:34,代码来源:PersistentPrioritySearchQueue.java


示例14: traverseAtMostRange

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq traverseAtMostRange(final Object low, final Object high, final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) > 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(low, lubound) <= 0 ?
                            traverseAtMostRange(low, high, priority, match.left) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, high) <= 0 ?
                            traverseAtMostRange(low, high, priority, match.right) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java


示例15: traverseBelowRange

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq traverseBelowRange(final Object low, final Object high, final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) >= 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(low, lubound) <= 0 ?
                            traverseBelowRange(low, high, priority, match.left) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, high) <= 0 ?
                            traverseBelowRange(low, high, priority, match.right) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java


示例16: rtraverseAtMostRange

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq rtraverseAtMostRange(final Object low, final Object high, final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) > 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, high) <= 0 ?
                            rtraverseAtMostRange(low, high, priority, match.right) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(low, lubound) <= 0 ?
                            rtraverseAtMostRange(low, high, priority, match.left) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java


示例17: rtraverseBelowRange

import clojure.lang.MapEntry; //导入依赖的package包/类
ISeq rtraverseBelowRange(final Object low, final Object high, final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) >= 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, high) <= 0 ?
                            rtraverseBelowRange(low, high, priority, match.right) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(low, lubound) <= 0 ?
                            rtraverseBelowRange(low, high, priority, match.left) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java


示例18: TaskAssignment

import clojure.lang.MapEntry; //导入依赖的package包/类
/**
 * Creates a new executor id.
 * 
 * @param object the object representing the executor
 * @param taskComponents a taskId-component name mapping
 */
TaskAssignment(Object object, Map<Integer, String> taskComponents) {
    if (object instanceof MapEntry) {
        MapEntry me = (MapEntry) object;
        Object key = me.getKey();
        if (key instanceof PersistentVector) {
            PersistentVector executor = (PersistentVector) key;
            if (2 == executor.size()) {
                Object start = executor.get(0);
                Object end = executor.get(1);
                if (start instanceof Integer && end instanceof Integer) {
                    Integer tmpStart = (Integer) start;
                    this.taskStart = tmpStart;
                    this.taskEnd = (Integer) end;
                    this.component = taskComponents.get(tmpStart);
                }
            }
        }
        Object val = me.getValue();
        if (val instanceof PersistentVector) {
            PersistentVector hostPort = (PersistentVector) val;
            if (2 == hostPort.size()) {
                Object host = hostPort.get(0);
                Object port = hostPort.get(1);
                if (host instanceof String && port instanceof Integer) {
                    this.hostId = (String) host;
                    this.port = (Integer) port;
                }
            }
        }
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:38,代码来源:TaskAssignment.java


示例19: readNodeHost

import clojure.lang.MapEntry; //导入依赖的package包/类
/**
 * Reads the node-host mapping from <code>assng</code>.
 * 
 * @param assng the assignment
 * @return the node-host mapping
 */
public static Map<String, String> readNodeHost(Assignment assng) {
    Map<String, String> result = new HashMap<String, String>();
    if (assng.node__GT_host instanceof APersistentMap) {
        APersistentMap nodeHost = (APersistentMap) assng.node__GT_host;
        for (Object entry : nodeHost.entrySet()) {
            if (entry instanceof MapEntry) {
                MapEntry ent = (MapEntry) entry;
                result.put(ent.getKey().toString(), ent.getValue().toString());
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:20,代码来源:TaskAssignment.java


示例20: entryOf

import clojure.lang.MapEntry; //导入依赖的package包/类
public static final MapEntry entryOf(final Object key, final Object val) {
    return new MapEntry(key, val);
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:4,代码来源:TrieMap_5Bits.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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