Class Conversions.WrappedLongArray

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.Long>, java.util.Collection<java.lang.Long>, java.util.List<java.lang.Long>, java.util.RandomAccess
    Enclosing class:
    Conversions

    public static final class Conversions.WrappedLongArray
    extends java.util.AbstractList<java.lang.Long>
    implements java.util.RandomAccess
    A list that is completely backed by an array of primitives and that provides access to that array. Only for internal use.
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.Object o)
      static Conversions.WrappedLongArray create​(long[] array)
      Creates a new Conversions.WrappedLongArray that is backed by the given primitive array.
      java.lang.Long get​(int index)
      int indexOf​(java.lang.Object o)
      long[] internalToArray()
      Returns the underlying array in an unsafe manner.
      int lastIndexOf​(java.lang.Object o)
      java.lang.Long set​(int index, java.lang.Long element)
      int size()
      • Methods inherited from class java.util.AbstractList

        add, add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

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

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

        forEach
      • Methods inherited from interface java.util.List

        addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Constructor Detail

      • WrappedLongArray

        protected WrappedLongArray​(long[] array)
        Internal constructor for Conversions.WrappedLongArray.
        Parameters:
        array - the to-be-wrapped array. May be null which will cause any method on the created object to fail with a NullPointerException.
    • Method Detail

      • create

        @Pure
        public static Conversions.WrappedLongArray create​(long[] array)
        Creates a new Conversions.WrappedLongArray that is backed by the given primitive array.
        Parameters:
        array - the to-be-wrapped array. May be null which will cause any method on the resulting object to fail.
        Returns:
        the wrapped array. Never null.
      • get

        public java.lang.Long get​(int index)
        Specified by:
        get in interface java.util.List<java.lang.Long>
        Specified by:
        get in class java.util.AbstractList<java.lang.Long>
        Throws:
        java.lang.NullPointerException - if the wrapped array was null.
        java.lang.IndexOutOfBoundsException
      • set

        public java.lang.Long set​(int index,
                                  java.lang.Long element)
        Specified by:
        set in interface java.util.List<java.lang.Long>
        Overrides:
        set in class java.util.AbstractList<java.lang.Long>
        Throws:
        java.lang.NullPointerException - if the wrapped array was null.
        java.lang.ClassCastException
        java.lang.NullPointerException
        java.lang.IllegalArgumentException
        java.lang.IndexOutOfBoundsException
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<java.lang.Long>
        Overrides:
        indexOf in class java.util.AbstractList<java.lang.Long>
        Throws:
        java.lang.NullPointerException - if the wrapped array was null.
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<java.lang.Long>
        Overrides:
        lastIndexOf in class java.util.AbstractList<java.lang.Long>
        Throws:
        java.lang.NullPointerException - if the wrapped array was null.
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<java.lang.Long>
        Specified by:
        contains in interface java.util.List<java.lang.Long>
        Overrides:
        contains in class java.util.AbstractCollection<java.lang.Long>
        Throws:
        java.lang.NullPointerException - if the wrapped array was null.
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.lang.Long>
        Specified by:
        size in interface java.util.List<java.lang.Long>
        Specified by:
        size in class java.util.AbstractCollection<java.lang.Long>
        Throws:
        java.lang.NullPointerException - if the wrapped array was null.
      • internalToArray

        public long[] internalToArray()
        Returns the underlying array in an unsafe manner. That is, modification of the array will be reflected by this list and vice versa.
        Returns:
        the underlying array. May be null if the list was created with a null argument.