Package com.cedarsoftware.io.util
Class EmptyListIterator<T>
java.lang.Object
com.cedarsoftware.io.util.EmptyListIterator<T>
- All Implemented Interfaces:
Iterator<T>
,ListIterator<T>
- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
License
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Throws UnsupportedOperationException because this operation is not supported by the empty list iterator.boolean
hasNext()
Returnsfalse
as there are no elements in any direction.boolean
Returnsfalse
as there are no elements in any direction.next()
Throws NoSuchElementException because there are no elements to return.int
Always returns 0 because there are no elements.previous()
Throws NoSuchElementException because there are no elements to return.int
Always returns -1 because there are no elements.void
remove()
Throws UnsupportedOperationException because this operation is not supported by the empty list iterator.void
Throws UnsupportedOperationException because this operation is not supported by the empty list iterator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
EmptyListIterator
public EmptyListIterator()
-
-
Method Details
-
hasNext
public boolean hasNext()Returnsfalse
as there are no elements in any direction. -
next
Throws NoSuchElementException because there are no elements to return. -
hasPrevious
public boolean hasPrevious()Returnsfalse
as there are no elements in any direction.- Specified by:
hasPrevious
in interfaceListIterator<T>
-
previous
Throws NoSuchElementException because there are no elements to return.- Specified by:
previous
in interfaceListIterator<T>
-
remove
public void remove()Throws UnsupportedOperationException because this operation is not supported by the empty list iterator. -
set
Throws UnsupportedOperationException because this operation is not supported by the empty list iterator.- Specified by:
set
in interfaceListIterator<T>
-
add
Throws UnsupportedOperationException because this operation is not supported by the empty list iterator.- Specified by:
add
in interfaceListIterator<T>
-
nextIndex
public int nextIndex()Always returns 0 because there are no elements.- Specified by:
nextIndex
in interfaceListIterator<T>
-
previousIndex
public int previousIndex()Always returns -1 because there are no elements.- Specified by:
previousIndex
in interfaceListIterator<T>
-