Class NaruLongSortedSet

java.lang.Object
net.thevpc.naru.api.util.NaruLongSortedSet

public class NaruLongSortedSet extends Object
Sorted set of primitive longs, ordered by value. O(log n) lookup, O(n) insert due to array shift. Optimized for small-to-medium sets with frequent ordered iteration. Not thread-safe — synchronize externally.
  • Constructor Details

    • NaruLongSortedSet

      public NaruLongSortedSet()
    • NaruLongSortedSet

      public NaruLongSortedSet(int initialCapacity)
  • Method Details

    • add

      public boolean add(long value)
    • contains

      public boolean contains(long value)
    • remove

      public boolean remove(long value)
    • get

      public long get(int index)
    • first

      public long first()
    • last

      public long last()
    • tailIndex

      public int tailIndex(long fromValue)
      Returns a view of values >= fromValue, as indices into iteration. Caller iterates from returned index forward.
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • toArray

      public long[] toArray()
    • toString

      public String toString()
      Overrides:
      toString in class Object