Class VisitorList<N extends Node>

  • All Implemented Interfaces:
    java.lang.Iterable<N>, java.util.Collection<N>, java.util.List<N>

    public class VisitorList<N extends Node>
    extends java.lang.Object
    implements java.util.List<N>
    A list that overrides the equals and hashcode calculation of the added nodes by using another equals and hashcode visitor for those methods.
    • Constructor Summary

      Constructors 
      Constructor Description
      VisitorList​(GenericVisitor<java.lang.Integer,​java.lang.Void> hashcodeVisitor, GenericVisitor<java.lang.Boolean,​Visitable> equalsVisitor)
      Pass the visitors to use for equals and hashcode.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, N elem)  
      boolean add​(N elem)  
      boolean addAll​(int index, java.util.Collection<? extends N> col)  
      boolean addAll​(java.util.Collection<? extends N> col)  
      void clear()  
      boolean contains​(java.lang.Object elem)  
      boolean containsAll​(java.util.Collection<?> col)  
      N get​(int index)  
      int indexOf​(java.lang.Object elem)  
      boolean isEmpty()  
      java.util.Iterator<N> iterator()  
      int lastIndexOf​(java.lang.Object elem)  
      java.util.ListIterator<N> listIterator()  
      java.util.ListIterator<N> listIterator​(int index)  
      N remove​(int index)  
      boolean remove​(java.lang.Object elem)  
      boolean removeAll​(java.util.Collection<?> col)  
      boolean retainAll​(java.util.Collection<?> col)  
      N set​(int index, N elem)  
      int size()  
      java.util.List<N> subList​(int fromIndex, int toIndex)  
      java.lang.Object[] toArray()  
      <T> T[] toArray​(T[] arr)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

        parallelStream, removeIf, stream
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        equals, hashCode, replaceAll, sort, spliterator
    • Constructor Detail

      • VisitorList

        public VisitorList​(GenericVisitor<java.lang.Integer,​java.lang.Void> hashcodeVisitor,
                           GenericVisitor<java.lang.Boolean,​Visitable> equalsVisitor)
        Pass the visitors to use for equals and hashcode.
    • Method Detail

      • add

        public boolean add​(N elem)
        Specified by:
        add in interface java.util.Collection<N extends Node>
        Specified by:
        add in interface java.util.List<N extends Node>
      • add

        public void add​(int index,
                        N elem)
        Specified by:
        add in interface java.util.List<N extends Node>
      • addAll

        public boolean addAll​(java.util.Collection<? extends N> col)
        Specified by:
        addAll in interface java.util.Collection<N extends Node>
        Specified by:
        addAll in interface java.util.List<N extends Node>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends N> col)
        Specified by:
        addAll in interface java.util.List<N extends Node>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<N extends Node>
        Specified by:
        clear in interface java.util.List<N extends Node>
      • contains

        public boolean contains​(java.lang.Object elem)
        Specified by:
        contains in interface java.util.Collection<N extends Node>
        Specified by:
        contains in interface java.util.List<N extends Node>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> col)
        Specified by:
        containsAll in interface java.util.Collection<N extends Node>
        Specified by:
        containsAll in interface java.util.List<N extends Node>
      • get

        public N get​(int index)
        Specified by:
        get in interface java.util.List<N extends Node>
      • indexOf

        public int indexOf​(java.lang.Object elem)
        Specified by:
        indexOf in interface java.util.List<N extends Node>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<N extends Node>
        Specified by:
        isEmpty in interface java.util.List<N extends Node>
      • iterator

        public java.util.Iterator<N> iterator()
        Specified by:
        iterator in interface java.util.Collection<N extends Node>
        Specified by:
        iterator in interface java.lang.Iterable<N extends Node>
        Specified by:
        iterator in interface java.util.List<N extends Node>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object elem)
        Specified by:
        lastIndexOf in interface java.util.List<N extends Node>
      • listIterator

        public java.util.ListIterator<N> listIterator()
        Specified by:
        listIterator in interface java.util.List<N extends Node>
      • listIterator

        public java.util.ListIterator<N> listIterator​(int index)
        Specified by:
        listIterator in interface java.util.List<N extends Node>
      • remove

        public boolean remove​(java.lang.Object elem)
        Specified by:
        remove in interface java.util.Collection<N extends Node>
        Specified by:
        remove in interface java.util.List<N extends Node>
      • remove

        public N remove​(int index)
        Specified by:
        remove in interface java.util.List<N extends Node>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> col)
        Specified by:
        removeAll in interface java.util.Collection<N extends Node>
        Specified by:
        removeAll in interface java.util.List<N extends Node>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> col)
        Specified by:
        retainAll in interface java.util.Collection<N extends Node>
        Specified by:
        retainAll in interface java.util.List<N extends Node>
      • set

        public N set​(int index,
                     N elem)
        Specified by:
        set in interface java.util.List<N extends Node>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<N extends Node>
        Specified by:
        size in interface java.util.List<N extends Node>
      • subList

        public java.util.List<N> subList​(int fromIndex,
                                         int toIndex)
        Specified by:
        subList in interface java.util.List<N extends Node>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<N extends Node>
        Specified by:
        toArray in interface java.util.List<N extends Node>
      • toArray

        public <T> T[] toArray​(T[] arr)
        Specified by:
        toArray in interface java.util.Collection<N extends Node>
        Specified by:
        toArray in interface java.util.List<N extends Node>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object