Example usage for com.google.common.collect ImmutableSortedSet tailSet

List of usage examples for com.google.common.collect ImmutableSortedSet tailSet

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSortedSet tailSet.

Prototype

ImmutableSortedSet<E> tailSet(E fromElement, boolean inclusive) 

Source Link

Usage

From source file:org.voltcore.utils.COWNavigableSet.java

@Override
public E pollFirst() {
    while (true) {
        ImmutableSortedSet<E> snapshot = m_set.get();
        E first = null;//www.  ja  va 2 s. c  o m
        if (snapshot.size() > 0) {
            first = snapshot.first();
        } else {
            return null;
        }
        ImmutableSortedSet.Builder<E> builder = ImmutableSortedSet.naturalOrder();
        builder.addAll(snapshot.tailSet(first, false));
        if (m_set.compareAndSet(snapshot, builder.build())) {
            return first;
        }
    }
}