MCPcopy Create free account
hub / github.com/apache/groovy / EmptyRange

Class EmptyRange

src/main/java/groovy/lang/EmptyRange.java:31–215  ·  view source on GitHub ↗

Constructing Ranges like 0..<0

Source from the content-addressed store, hash-verified

29 * Constructing Ranges like 0..<0
30 */
31public class EmptyRange<T extends Comparable> extends AbstractList<T> implements Range<T> {
32
33 /**
34 * The value at which the range originates (may be <code>null</code>).
35 */
36 protected T at;
37
38 /**
39 * Creates a new {@link EmptyRange}.
40 *
41 * @param at the value at which the range starts (may be <code>null</code>).
42 */
43 public EmptyRange(T at) {
44 this.at = at;
45 }
46
47 /**
48 * {@inheritDoc}
49 */
50 @Override
51 public T getFrom() {
52 return at;
53 }
54
55 /**
56 * {@inheritDoc}
57 */
58 @Override
59 public T getTo() {
60 return at;
61 }
62
63 /**
64 * Never true for an empty range.
65 *
66 * @return <code>false</code>
67 */
68 @Override
69 public boolean isReverse() {
70 return false;
71 }
72
73 /**
74 * Never true for an empty range.
75 *
76 * @return <code>false</code>
77 */
78 @Override
79 public boolean containsWithinBounds(Object o) {
80 return false;
81 }
82
83 /**
84 * {@inheritDoc}
85 */
86 @Override
87 public String inspect() {
88 return FormatHelper.inspect(at) + "..<" + FormatHelper.inspect(at);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected