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 TypeMethodDescriptionvoidThrows UnsupportedOperationException because this operation is not supported by the empty list iterator.booleanhasNext()Returnsfalseas there are no elements in any direction.booleanReturnsfalseas there are no elements in any direction.next()Throws NoSuchElementException because there are no elements to return.intAlways returns 0 because there are no elements.previous()Throws NoSuchElementException because there are no elements to return.intAlways returns -1 because there are no elements.voidremove()Throws UnsupportedOperationException because this operation is not supported by the empty list iterator.voidThrows 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, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
EmptyListIterator
public EmptyListIterator()
-
-
Method Details
-
hasNext
public boolean hasNext()Returnsfalseas there are no elements in any direction. -
next
Throws NoSuchElementException because there are no elements to return. -
hasPrevious
public boolean hasPrevious()Returnsfalseas there are no elements in any direction.- Specified by:
hasPreviousin interfaceListIterator<T>
-
previous
Throws NoSuchElementException because there are no elements to return.- Specified by:
previousin 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:
setin interfaceListIterator<T>
-
add
Throws UnsupportedOperationException because this operation is not supported by the empty list iterator.- Specified by:
addin interfaceListIterator<T>
-
nextIndex
public int nextIndex()Always returns 0 because there are no elements.- Specified by:
nextIndexin interfaceListIterator<T>
-
previousIndex
public int previousIndex()Always returns -1 because there are no elements.- Specified by:
previousIndexin interfaceListIterator<T>
-