RandomAccessListDiscriminator

A RandomAccessListDiscriminator discriminates Lists. It discriminates its input by calling get() to extract the list elements, then it uses another Discriminator to discriminate on the elements of the list. It determines which discriminator to use on the elements of the list based on the type of the first non-null element it finds. If the Lists are RandomAccess, e.g. ArrayList, Stack, Vector, then element access is constant-time and performance should be better than for non-RandomAccess Lists.

Example

Given the input...

  • {ArrayList(1, 2, 3), Stack(1, 2, 3), Vector(1, 2, 3)), ArrayList(1, 2, 4), ArrayList(5), ArrayList(3, 2, 1)}

... a RandomAccessListDiscriminator returns the following equivalence classes:

  • {ArrayList(1, 2, 4)}
  • {ArrayList(5)}
  • {ArrayList(3, 2, 1)}
  • {ArrayList(1, 2, 3), Stack(1, 2, 3), Vector(1, 2, 3)}