Class CollectionUtils.EquatorWrapper<O>

  • Type Parameters:
    O - the element type
    Enclosing class:
    CollectionUtils

    private static class CollectionUtils.EquatorWrapper<O>
    extends java.lang.Object
    Wraps another object and uses the provided Equator to implement equals(Object) and hashCode().

    This class can be used to store objects into a Map.

    Since:
    4.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Equator<? super O> equator  
      private O object  
    • Constructor Summary

      Constructors 
      Constructor Description
      EquatorWrapper​(Equator<? super O> equator, O object)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      O getObject()  
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • equator

        private final Equator<? super O> equator
      • object

        private final O object
    • Constructor Detail

      • EquatorWrapper

        public EquatorWrapper​(Equator<? super O> equator,
                              O object)
    • Method Detail

      • getObject

        public O getObject()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object