Class ArrayFieldMap<T>

  • All Implemented Interfaces:
    FieldMap<T>

    final class ArrayFieldMap<T>
    extends java.lang.Object
    implements FieldMap<T>
    Field mapping implemented on top of java array for lookup by number. This is the most efficient implementation for almost all cases. But it should not be used when field numbers are sparse and especially when max field number is big - as this mapping internally uses array of integers with size equal to max field number. In latter case HashFieldMap should be used.
    See Also:
    HashFieldMap
    • Field Detail

      • fields

        private final java.util.List<Field<T>> fields
      • fieldsByNumber

        private final Field<T>[] fieldsByNumber
      • fieldsByName

        private final java.util.Map<java.lang.String,​Field<T>> fieldsByName
    • Constructor Detail

      • ArrayFieldMap

        public ArrayFieldMap​(java.util.Collection<Field<T>> fields,
                             int lastFieldNumber)