List of usage examples for com.google.common.collect ImmutableSortedSet headSet
ImmutableSortedSet<E> headSet(E toElement, boolean inclusive)
From source file:org.voltcore.utils.COWNavigableSet.java
@Override public E pollLast() { while (true) { ImmutableSortedSet<E> snapshot = m_set.get(); E last = null;/*from w ww . jav a2 s .co m*/ if (snapshot.size() > 0) { last = snapshot.last(); } else { return null; } ImmutableSortedSet.Builder<E> builder = ImmutableSortedSet.naturalOrder(); builder.addAll(snapshot.headSet(last, false)); if (m_set.compareAndSet(snapshot, builder.build())) { return last; } } }