public K firstKey() { return this.treeMap.firstKey(); }
@Override public K firstKey() { return this.treeMap.firstKey(); }
@Override public K firstKey() { return this.treeMap.firstKey(); }
/** */ private Long activeMinimal() { Long min = null; for (TreeMap<Long, AtomicInteger> s : activeQueries.values()) { Long first = s.firstKey(); if (min == null || first < min) min = first; } return min; } }
/** * Get the 0-based number of the first cell contained in this row. * * @return short representing the first logical cell in the row, * or -1 if the row does not contain any cells. */ @Override public short getFirstCellNum() { return (short)(_cells.size() == 0 ? -1 : _cells.firstKey()); }
@Override public E next() { count++; return values.remove(currentElements.remove(currentElements.firstKey())); }
TreeMap<String, String> myMap = new TreeMap<String, String>(); String first = myMap.firstEntry().getValue(); String firstOther = myMap.get(myMap.firstKey());
/** * Print the time series sparsely, i.e. it ignores buckets with 0 events. * * @param stream the print stream */ public void sparsePrint(PrintStream stream) { if (mSeries.isEmpty()) { return; } long start = mSeries.firstKey(); stream.printf("Time series starts at %d with width %d.%n", start, mWidthNano); for (Map.Entry<Long, Integer> entry : mSeries.entrySet()) { stream.printf("%d %d%n", (entry.getKey() - start) / mWidthNano, entry.getValue()); } }
/** * Returns the smallest key in this symbol table. * * @return the smallest key in this symbol table * @throws NoSuchElementException if this symbol table is empty */ public Key min() { if (isEmpty()) throw new NoSuchElementException("calls min() with empty symbol table"); return st.firstKey(); }
public S getShardInfo(byte[] key) { SortedMap<Long, S> tail = nodes.tailMap(algo.hash(key)); if (tail.isEmpty()) { return nodes.get(nodes.firstKey()); } return tail.get(tail.firstKey()); }
public long getMaxSpan() { try { this.lockTreeMap.readLock().lockInterruptibly(); try { if (!this.msgTreeMap.isEmpty()) { return this.msgTreeMap.lastKey() - this.msgTreeMap.firstKey(); } } finally { this.lockTreeMap.readLock().unlock(); } } catch (InterruptedException e) { log.error("getMaxSpan exception", e); } return 0; }
public long estimatedMemSize() { if (aggBufMap.isEmpty()) return 0; byte[] sampleKey = aggBufMap.firstKey(); MeasureAggregator<?>[] sampleValue = aggBufMap.get(sampleKey); return estimateSizeOfAggrCache(sampleKey, sampleValue, aggBufMap.size()); }
private int[] minIdMap() { double key = sortmap.firstKey(); Set<String> set = sortmap.get(key); Iterator<String> it = set.iterator(); int[] id = string2Id(it.next()); // System.out.println(key + " " + id[0] + " " + id[1]); return id; }
public S selectForKey(String key) { SortedMap<Long, S> tail = nodes.tailMap(hash(key)); // 沿环的顺时针找到一个虚拟节点 if (tail.size() == 0) { return nodes.get(nodes.firstKey()); } return tail.get(tail.firstKey()); // 返回该虚拟节点对应的真实机器节点的信息 }
public S selectForKey(String key) { SortedMap<Long, S> tail = nodes.tailMap(hash(key)); // 沿环的顺时针找到一个虚拟节点 if (tail.size() == 0) { return nodes.get(nodes.firstKey()); } return tail.get(tail.firstKey()); // 返回该虚拟节点对应的真实机器节点的信息 }
public void fillProcessQueueInfo(final ProcessQueueInfo info) { try { this.lockTreeMap.readLock().lockInterruptibly(); if (!this.msgTreeMap.isEmpty()) { info.setCachedMsgMinOffset(this.msgTreeMap.firstKey()); info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey()); info.setCachedMsgCount(this.msgTreeMap.size()); info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024))); } if (!this.consumingMsgOrderlyTreeMap.isEmpty()) { info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey()); info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey()); info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size()); } info.setLocked(this.locked); info.setTryUnlockTimes(this.tryUnlockTimes.get()); info.setLastLockTimestamp(this.lastLockTimestamp); info.setDroped(this.dropped); info.setLastPullTimestamp(this.lastPullTimestamp); info.setLastConsumeTimestamp(this.lastConsumeTimestamp); } catch (Exception e) { } finally { this.lockTreeMap.readLock().unlock(); } }
@Test public void generateOmemoPreKeysIdsMatchAndNoNullValues() { TreeMap<Integer, T_PreKey> pks = keyUtil.generateOmemoPreKeys(1, 20); for (int i = 1; i <= 20; i++) { assertEquals("PreKeyIds must correspond the requested ids.", Integer.valueOf(i), pks.firstKey()); assertNotNull("All PreKeys must not be null.", pks.get(pks.firstKey())); pks.remove(pks.firstKey()); } }