MCPcopy Create free account
hub / github.com/e2wugui/zeze / peek

Method peek

ZezeJava/ZezeJava/src/main/java/Zeze/Collections/Queue.java:283–298  ·  view source on GitHub ↗

@return 头节点的首个值,null if empty

()

Source from the content-addressed store, hash-verified

281 * @return 头节点的首个值,null if empty
282 */
283 public V peek() {
284 var root = getRoot();
285 if (root == null)
286 return null;
287
288 var headKey = root.getHeadNodeKey();
289 if (headKey.getNodeId() == 0)
290 return null;
291 var head = getNode(headKey);
292 if (head == null)
293 return null;
294
295 @SuppressWarnings("unchecked")
296 var value = (V)head.getValues().get(0).getValue().getBean();
297 return value;
298 }
299
300 public long size() {
301 var root = getRoot();

Callers 3

test1_QueueAddMethod · 0.45
test4_QueuePushMethod · 0.45
tryPushMessageMethod · 0.45

Calls 8

getRootMethod · 0.95
getNodeMethod · 0.95
getHeadNodeKeyMethod · 0.65
getNodeIdMethod · 0.65
getBeanMethod · 0.65
getValueMethod · 0.65
getMethod · 0.65
getValuesMethod · 0.45

Tested by 2

test1_QueueAddMethod · 0.36
test4_QueuePushMethod · 0.36