/** Dumps the seqnos in the table as a list */ public String dump() { lock.lock(); try { return stream(low, hr).filter(Objects::nonNull).map(Object::toString) .collect(Collectors.joining(", ")); } finally { lock.unlock(); } }
/** Iterate from low to hr and add up non-null values. Caller must hold the lock. */ @GuardedBy("lock") public int computeSize() { return (int)stream().filter(Objects::nonNull).count(); }
protected static long sizeOfAllMessages(Table<Message> buf, boolean include_headers) { return buf.stream().reduce(0L, (size,el) -> { if(el == null) return size; else return size + (include_headers? el.size() : el.getLength()); }, (l,r) -> l); }
/** Dumps the seqnos in the table as a list */ public String dump() { lock.lock(); try { return stream(low, hr).filter(Objects::nonNull).map(Object::toString) .collect(Collectors.joining(", ")); } finally { lock.unlock(); } }
/** Iterate from low to hr and add up non-null values. Caller must hold the lock. */ @GuardedBy("lock") public int computeSize() { return (int)stream().filter(Objects::nonNull).count(); }
protected static long sizeOfAllMessages(Table<Message> buf, boolean include_headers) { return buf.stream().reduce(0L, (size,el) -> { if(el == null) return size; else return size + (include_headers? el.size() : el.getLength()); }, (l,r) -> l); }