Class LRUSet<T>

  • Type Parameters:
    T - the type of items in the set
    All Implemented Interfaces:
    java.lang.Iterable<T>, java.util.Map<T,​T>

    public class LRUSet<T>
    extends LRUMap<T,​T>
    implements java.lang.Iterable<T>
    An ordered set-like data structure.

    Use this when you need a collection of unique items (hence set) that are also ordered by insertion time.

    • Field Summary

      • Fields inherited from class ghidra.util.datastruct.LRUMap

        map
    • Constructor Summary

      Constructors 
      Constructor Description
      LRUSet​(int size)
      Constructs this set with the given size.
    • Constructor Detail

      • LRUSet

        public LRUSet​(int size)
        Constructs this set with the given size. As elements are added, the oldest elements (by access time) will fall off the bottom of the set.

        If you do not wish to have a set bounded by size, then you can override LRUMap.removeEldestEntry(java.util.Map.Entry) to do nothing.

        Parameters:
        size - The size to which this set will be restricted.
    • Method Detail

      • add

        public void add​(T t)
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class LRUMap<T,​T>