Class IntegerIdProvider<T>

  • Type Parameters:
    T - the element type
    All Implemented Interfaces:
    java.util.function.Function<T,​java.lang.String>

    public class IntegerIdProvider<T>
    extends java.lang.Object
    implements java.util.function.Function<T,​java.lang.String>
    Assign a unique integer identifier to a set of elements. Each instance of provider maintains an internal map between every element it has ever seen and the unique integer representing that element.
    Author:
    Trevor Harmon
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String apply​(T t)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Constructor Detail

      • IntegerIdProvider

        public IntegerIdProvider()
        Create a new provider
      • IntegerIdProvider

        public IntegerIdProvider​(int nextId)
        Create a new provider.
        Parameters:
        nextId - identifier to start from
    • Method Detail

      • apply

        public java.lang.String apply​(T t)
        Specified by:
        apply in interface java.util.function.Function<T,​java.lang.String>