Class MyLinkedList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List

    public class MyLinkedList
    extends java.util.AbstractSequentialList
    implements java.lang.Cloneable, java.io.Serializable, java.util.List
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      MyLinkedList()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.Object element)
      add an object to the list at the specified index
      boolean add​(java.lang.Object o)
      add an object to the list
      void checkSafety()  
      java.lang.Object get​(int index)
      get an object from the linked list
      java.util.ListIterator listIterator​(int index)  
      java.lang.Object remove​(int index)
      remove an object at the specified index
      int size()  
      java.util.List subList​(int beginAt, int endAt)  
      • Methods inherited from class java.util.AbstractSequentialList

        addAll, iterator, set
      • Methods inherited from class java.util.AbstractList

        clear, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, 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, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, toArray, toArray
    • Constructor Detail

      • MyLinkedList

        public MyLinkedList()
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection
        Specified by:
        size in interface java.util.List
        Specified by:
        size in class java.util.AbstractCollection
      • subList

        public java.util.List subList​(int beginAt,
                                      int endAt)
        Specified by:
        subList in interface java.util.List
        Overrides:
        subList in class java.util.AbstractList
      • add

        public boolean add​(java.lang.Object o)
        add an object to the list
        Specified by:
        add in interface java.util.Collection
        Specified by:
        add in interface java.util.List
        Overrides:
        add in class java.util.AbstractList
      • add

        public void add​(int index,
                        java.lang.Object element)
        add an object to the list at the specified index
        Specified by:
        add in interface java.util.List
        Overrides:
        add in class java.util.AbstractSequentialList
      • get

        public java.lang.Object get​(int index)
        get an object from the linked list
        Specified by:
        get in interface java.util.List
        Overrides:
        get in class java.util.AbstractSequentialList
      • remove

        public java.lang.Object remove​(int index)
        remove an object at the specified index
        Specified by:
        remove in interface java.util.List
        Overrides:
        remove in class java.util.AbstractSequentialList
      • listIterator

        public java.util.ListIterator listIterator​(int index)
        Specified by:
        listIterator in interface java.util.List
        Specified by:
        listIterator in class java.util.AbstractSequentialList
      • checkSafety

        public void checkSafety()