On this page
[Java] Class EmptyRange<T extends Comparable>
- groovy.lang.EmptyRange
- All Implemented Interfaces and Traits:
- Range
public class EmptyRange<T extends Comparable>
extends AbstractList
implements Range
Constructing Ranges like 0..<0
Field Summary
Modifiers | Name | Description |
---|---|---|
protected T |
at |
The value at which the range originates (may be null ). |
Constructor Summary
Constructor and description |
---|
EmptyRange(T at) Creates a new EmptyRange. |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public boolean |
add(T o) Always throws UnsupportedOperationException for an empty range. |
|
public boolean |
addAll(int index, Collection<? extends T> c) Always throws UnsupportedOperationException for an empty range. |
|
public boolean |
addAll(Collection<? extends T> c) Always throws UnsupportedOperationException for an empty range. |
|
public boolean |
containsWithinBounds(Object o) Never true for an empty range. |
|
public T |
get(int index) Always throws IndexOutOfBoundsException for an empty range. |
|
public T |
getFrom() {@inheritDoc} |
|
public T |
getTo() {@inheritDoc} |
|
public String |
inspect() {@inheritDoc} |
|
public boolean |
isReverse() Never true for an empty range. |
|
public boolean |
remove(Object o) Always throws UnsupportedOperationException for an empty range. |
|
public T |
remove(int index) Always throws UnsupportedOperationException for an empty range. |
|
public boolean |
removeAll(Collection<?> c) Always throws UnsupportedOperationException for an empty range. |
|
public boolean |
retainAll(Collection<?> c) Always throws UnsupportedOperationException for an empty range. |
|
public T |
set(int index, T element) Always throws UnsupportedOperationException for an empty range. |
|
public int |
size() Always 0 for an empty range. |
|
public void |
step(int step, Closure closure) Always does nothing for an empty range. |
|
public List<T> |
step(int step) Always returns an empty list for an empty range. |
|
public String |
toString() {@inheritDoc} |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class AbstractList |
add, add, remove, get, equals, hashCode, indexOf, clear, lastIndexOf, subList, iterator, addAll, set, listIterator, listIterator, remove, toString, isEmpty, size, toArray, toArray, contains, addAll, removeAll, retainAll, containsAll, wait, wait, wait, getClass, notify, notifyAll, toArray, stream, spliterator, removeIf, parallelStream, forEach, replaceAll, sort |
Field Detail
protected T at
The value at which the range originates (may be null
).
Constructor Detail
public EmptyRange(T at)
Creates a new EmptyRange.
- Parameters:
at
- the value at which the range starts (may benull
).
Method Detail
@Override public boolean add(T o)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException always
@Override public boolean addAll(int index, Collection<? extends T> c)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException
@Override public boolean addAll(Collection<? extends T> c)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException
@Override public boolean containsWithinBounds(Object o)
Never true for an empty range.
- Returns:
-
false
@Override public T get(int index)
Always throws IndexOutOfBoundsException
for an empty range.
- throws:
- IndexOutOfBoundsException always
@Override public T getFrom()
{@inheritDoc}
@Override public T getTo()
{@inheritDoc}
@Override public String inspect()
{@inheritDoc}
@Override public boolean isReverse()
Never true for an empty range.
- Returns:
-
false
@Override public boolean remove(Object o)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException
@Override public T remove(int index)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException
@Override public boolean removeAll(Collection<?> c)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException
@Override public boolean retainAll(Collection<?> c)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException
@Override public T set(int index, T element)
Always throws UnsupportedOperationException
for an empty range.
- throws:
- UnsupportedOperationException
@Override public int size()
Always 0 for an empty range.
- Returns:
- 0
@Override public void step(int step, Closure closure)
Always does nothing for an empty range.
@Override public List<T> step(int step)
Always returns an empty list for an empty range.
@Override public String toString()
{@inheritDoc}
© 2003-2022 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/4.0.0/html/gapi/groovy/lang/EmptyRange.html